TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ken Linder
NA
1
0
Sharing a Generic Collection
Apr 5 2008 8:05 PM
Seems quiet in here, but I will throw this out here anyway.
I have a Windows Forms C# program (using .NET ver 2) that has several heterogeneous threads (BackgroundWorker) that need to access a common Generic Collection that is a private property in the Form collection. Example:
BackgroundWorker 1 - Reads POP3 e-mails and places them in the collection.
BackgroundWorker 2 - Scans the collection for work to do.
BackgroundWorker 3 - Scan the collection and report on work done.
BackgroundWorker 4 - Scan the collection and handle trapped exceptions and housekeeping.
Now, when I create each thread, I have this in the BackgroundWorker class...
public MyCollectionClass MyCollection.
My creating code does...
newBackgroundWorker.MyCollection = GlobalCollection;
Now, I thought that when I did this, I was assigning a reference into the class, not copying the collection. It seems to be copying the entire collection, not pointing the property in the BackgroundWorker to the global collection.
Thoughts? How DO I get several threads like this to share a collection?
TIA
-Ken
Reply
Answers (
1
)
Multi Threading with BinaryWriter
async reading using beginread