コード例 #1
0
        public bool TryGetValue(TKey key, out TValue value)
        {
            CollectionStateObjectReference internalValue;
            var ret = internalDictCase5.TryGetValue(key, out internalValue);

            if (ret)
            {
                var cont = internalValue.Target as IPromise;
                if (cont != null)
                {
                    value = (TValue)DictionaryUtils.RetrieveDelegateFromPromise(typeof(TValue), cont);
                }
                else
                {
                    value = default(TValue);
                }
                return(true);
            }
            value = default(TValue);
            return(false);
        }
コード例 #2
0
 public TValue this [TKey key] {
     get {
         var    entry5    = internalDictCase5[key];
         TValue retEntry5 = (TValue)DictionaryUtils.RetrieveDelegateFromPromise(typeof(TValue), (IPromise)entry5.Target);
         return(retEntry5);
     }
     set {
         //Erase old reference
         CollectionStateObjectReference internalValue;
         if (internalDictCase5.TryGetValue(key, out internalValue) /*&& internalValue !=null*/)
         {
             if (!internalValue.IsNull)
             {
                 stateManager.RemoveObject(internalValue.TargetUniqueID, mustDetach: true, deep: true);
                 RemoveReferenceFromStateObjectSurrogate(internalValue);
             }
         }
         //This is multicast delegate create contiuation
         var val = DictionaryUtils.CreatePromise(stateManager, ((Delegate)(object)value));
         internalDictCase5 [key] = new CollectionStateObjectReference((IStateObject)val);
         AddReferenceIntoStateObjectSurrogate(val);
     }
 }