On Sep 3, 2012, at 1:31 AM, vnan122 <veeresh...@gmail.com> wrote:
> Hello every one, I just want to know how to make a list thread safe

In practice, you don't; a method can do anything...

By convention, you can generally assume that static members are thread safe and 
instance members are not (unless those instance methods are exposed from static 
methods, e.g. System.Reflection), but that's by no means guaranteed and may be 
violated.

In general, you need to read the documentation to determine which members are 
threadsafe and which are not.

> and is there any options for concurrent list like in JAVA.

Have you tried System.Collections.Concurrent.ConcurrentBag<T>?

        http://msdn.microsoft.com/en-us/library/dd381779.aspx

This assumes that you don't need to maintain ordering.

Of course, you could always just use List<T> + `lock`, unless/until profiling 
demonstrates that you're spending too much time acquiring locks...

 - Jon

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to