C# StringCollection SyncRoot

Description

StringCollection SyncRoot gets an object that can be used to synchronize access to the StringCollection.

Syntax

StringCollection.SyncRoot has the following syntax.


public Object SyncRoot { get; }

Example


/* w w  w . j a v  a 2  s .c om*/
using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringCollection  {

   public static void Main()  {
        StringCollection myCollection = new StringCollection();
        lock(myCollection.SyncRoot)
        {
            foreach (object item in myCollection)
            {
                // Insert your code here.
            }
        }
   }
}




















Home »
  C# Tutorial »
    System.Collections.Specialized »




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator