/// <summary>
 /// Initializes a new instance of the <see cref="ConcurrentObservableCollection{T}" /> class.
 /// </summary>
 public ConcurrentObservableCollection()
 {
     using (_syncLock.Read())
     {
         enableCollectionSynchronization(this, _syncLock);
     }
 }
Exemplo n.º 2
0
 public IEnumerator <string> GetEnumerator()
 {
     //Console.WriteLine("当前线程:" + Thread.CurrentThread.ManagedThreadId);
     using (_Lock.Read())
     {
         //Console.WriteLine("进入读锁的线程:" + Thread.CurrentThread.ManagedThreadId);
         foreach (var item in _List)
         {
             yield return(item);
         }
     }
 }
Exemplo n.º 3
0
 public IEnumerator <T> GetEnumerator()
 {
     using (_lock.Read())
         return(_list.GetEnumerator());
 }