public IAsyncResult BeginWaitForPendingOperations(string sessionId, TimeSpan timeout, AsyncCallback callback, object state)
 {
     PendingOperationAsyncResult result = null;
     lock (this.thisLock)
     {
         if (this.pendingOperations == null)
         {
             this.pendingOperations = new Dictionary<string, List<PendingOperationAsyncResult>>();
         }
         List<PendingOperationAsyncResult> pendingList;
         if (!this.pendingOperations.TryGetValue(sessionId, out pendingList))
         {
             pendingList = new List<PendingOperationAsyncResult>();
             this.pendingOperations.Add(sessionId, pendingList);
         }
         bool isFirstRequest = (pendingList.Count == 0);
         result = new PendingOperationAsyncResult(isFirstRequest, timeout, callback, state);
         pendingList.Add(result);
         ++this.pendingOperationCount;
     }
     result.Start();
     return result;
 }
 public IAsyncResult BeginWaitForPendingOperations(string sessionId, TimeSpan timeout, AsyncCallback callback, object state)
 {
     PendingOperationAsyncResult item = null;
     lock (this.thisLock)
     {
         List<PendingOperationAsyncResult> list;
         if (this.pendingOperations == null)
         {
             this.pendingOperations = new Dictionary<string, List<PendingOperationAsyncResult>>();
         }
         if (!this.pendingOperations.TryGetValue(sessionId, out list))
         {
             list = new List<PendingOperationAsyncResult>();
             this.pendingOperations.Add(sessionId, list);
         }
         bool isFirstRequest = list.Count == 0;
         item = new PendingOperationAsyncResult(isFirstRequest, timeout, callback, state);
         list.Add(item);
         this.pendingOperationCount++;
     }
     item.Start();
     return item;
 }