Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
AnswerRe: Combobox.SelectedValue and Combobox.Text Pin
Mycroft Holmes10-Jul-14 14:25
professionalMycroft Holmes10-Jul-14 14:25 
GeneralRe: Combobox.SelectedValue and Combobox.Text Pin
JCompiler10-Jul-14 23:39
JCompiler10-Jul-14 23:39 
AnswerRe: Combobox.SelectedValue and Combobox.Text Pin
Dilan Shaminda14-Jul-14 7:43
professionalDilan Shaminda14-Jul-14 7:43 
QuestionC# Pin
livhuone9-Jul-14 23:04
livhuone9-Jul-14 23:04 
AnswerRe: C# Pin
OriginalGriff9-Jul-14 23:41
mveOriginalGriff9-Jul-14 23:41 
AnswerRe: C# Pin
Richard MacCutchan9-Jul-14 23:43
mveRichard MacCutchan9-Jul-14 23:43 
QuestionReading and writing from a List<string> simultaneously Pin
Retro6179-Jul-14 16:06
Retro6179-Jul-14 16:06 
AnswerRe: Reading and writing from a List<string> simultaneously Pin
Dave Kreskowiak9-Jul-14 18:50
mveDave Kreskowiak9-Jul-14 18:50 
The biggest problem with doing what you're doing is that List<t> isn't thread safe. You really shouldn't be trying to Add and Remove items from the List<t> without synchronization in place to avoid nasty little bugs that you're going to have a hell of a time reproducing.

Read:
Quote:
Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

It is safe to perform multiple read operations on a List<t>, but issues can occur if the collection is modified while it’s being read. To ensure thread safety, lock the collection during a read or write operation. To enable a collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. For collections with built-in synchronization, see the classes in the System.Collections.Concurrent namespace. For an inherently thread–safe alternative, see the ImmutableList class.


A better alternative would be to use a ConcurrentQueue<t>[^] instead.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

QuestionAutoUpdater c# wpf xmal Pin
EvilRevenger9-Jul-14 14:29
EvilRevenger9-Jul-14 14:29 
AnswerRe: AutoUpdater c# wpf xmal Pin
Pete O'Hanlon9-Jul-14 20:05
mvePete O'Hanlon9-Jul-14 20:05 
AnswerRe: AutoUpdater c# wpf xmal Pin
GuyThiebaut10-Jul-14 3:29
professionalGuyThiebaut10-Jul-14 3:29 
GeneralRe: AutoUpdater c# wpf xmal Pin
Dave Kreskowiak10-Jul-14 3:45
mveDave Kreskowiak10-Jul-14 3:45 
GeneralRe: AutoUpdater c# wpf xmal Pin
GuyThiebaut10-Jul-14 3:57
professionalGuyThiebaut10-Jul-14 3:57 
GeneralRe: AutoUpdater c# wpf xmal Pin
EvilRevenger10-Jul-14 5:46
EvilRevenger10-Jul-14 5:46 
GeneralRe: AutoUpdater c# wpf xmal Pin
GuyThiebaut10-Jul-14 9:42
professionalGuyThiebaut10-Jul-14 9:42 
GeneralRe: AutoUpdater c# wpf xmal Pin
EvilRevenger10-Jul-14 15:49
EvilRevenger10-Jul-14 15:49 
QuestionUsing a .txt file as input from network folder Pin
CaptainJack6839-Jul-14 11:38
CaptainJack6839-Jul-14 11:38 
AnswerRe: Using a .txt file as input from network folder Pin
Dave Kreskowiak9-Jul-14 12:20
mveDave Kreskowiak9-Jul-14 12:20 
GeneralRe: Using a .txt file as input from network folder Pin
CaptainJack68310-Jul-14 3:32
CaptainJack68310-Jul-14 3:32 
GeneralNeed Extension methods as mentioned below Pin
prasanna_durai9-Jul-14 7:09
prasanna_durai9-Jul-14 7:09 
GeneralRe: Need Extension methods as mentioned below Pin
Matt T Heffron9-Jul-14 7:38
professionalMatt T Heffron9-Jul-14 7:38 
GeneralRe: Need Extension methods as mentioned below Pin
OriginalGriff9-Jul-14 8:11
mveOriginalGriff9-Jul-14 8:11 
QuestionSplit tag xml in more file xml, with C# Pin
Federico Barbieri8-Jul-14 22:50
Federico Barbieri8-Jul-14 22:50 
SuggestionRe: Split tag xml in more file xml, with C# Pin
Richard MacCutchan8-Jul-14 23:20
mveRichard MacCutchan8-Jul-14 23:20 
AnswerRe: Split tag xml in more file xml, with C# Pin
Richard Deeming9-Jul-14 2:05
mveRichard Deeming9-Jul-14 2:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.