예제 #1
0
 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);
 }
예제 #2
0
    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>
    }
예제 #3
0
파일: source.cs 프로젝트: zhimaqiao51/docs
    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>
    }