Check if StringCollection is synchronized (thread safe) in CSharp

Description

The following code shows how to check if StringCollection is synchronized (thread safe).

Example


/*from  www . j  a va  2 s  .  co m*/
using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringCollection  {

   public static void Main()  {
      StringCollection myCol = new StringCollection();
      String[] myArr = new String[] { "A", "B", "C", "java2s.com"};
      myCol.AddRange( myArr );


      Console.WriteLine( myCol.IsSynchronized);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary