public void SetUp() { baseCollection = new PublicSafetyPerson(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()); baseCollection.LastName = "data"; baseCollection.FirstName = "data1"; lst = new List <PublicSafetyPerson>(); lst.Add(baseCollection); derivedCollectionObj = new DerivedCollection <FieldInterviewSource, PublicSafetyPerson>(lst); }
public static void Main() { // <Snippet2> // Create a collection derived from NameObjectCollectionBase ICollection myCollection = new DerivedCollection(); lock (myCollection.SyncRoot) { foreach (object item in myCollection) { // Insert your code here. } } // </Snippet2> }
public static void Main() { // <Snippet1> // Create a collection derived from NameObjectCollectionBase NameObjectCollectionBase myBaseCollection = new DerivedCollection(); // Get the ICollection from NameObjectCollectionBase.KeysCollection ICollection myKeysCollection = myBaseCollection.Keys; lock (myKeysCollection.SyncRoot) { foreach (object item in myKeysCollection) { // Insert your code here. } } // </Snippet1> }