コード例 #1
0
 public object this[int key]
 {
     get
     {
         if (this._mapStore != null)
         {
             return(this._mapStore.Search(key));
         }
         return(RadProperty.UnsetValue);
     }
     set
     {
         if (value != RadProperty.UnsetValue)
         {
             if (this._mapStore == null)
             {
                 this._mapStore = new LargeSortedObjectMap();
             }
             FrugalMapStoreState frugalMapStoreState = this._mapStore.InsertEntry(key, value);
             if (frugalMapStoreState == FrugalMapStoreState.Success)
             {
                 return;
             }
             if (FrugalMapStoreState.SortedArray != frugalMapStoreState)
             {
                 throw new InvalidOperationException("FrugalMap: CannotPromoteBeyondHashtable");
             }
             LargeSortedObjectMap largeSortedObjectMap = new LargeSortedObjectMap();
             this._mapStore.Promote((FrugalMapBase)largeSortedObjectMap);
             this._mapStore = largeSortedObjectMap;
             int num = (int)this._mapStore.InsertEntry(key, value);
         }
         else
         {
             if (this._mapStore == null)
             {
                 return;
             }
             this._mapStore.RemoveEntry(key);
             if (this._mapStore.Count != 0)
             {
                 return;
             }
             this._mapStore = (LargeSortedObjectMap)null;
         }
     }
 }
コード例 #2
0
 public object this[int key]
 {
     get
     {
         if (this._mapStore != null)
         {
             return(this._mapStore.Search(key));
         }
         return(RadProperty.UnsetValue);
     }
     set
     {
         if (value != RadProperty.UnsetValue)
         {
             if (this._mapStore == null)
             {
                 this._mapStore = (FrugalMapBase) new SingleObjectMap();
             }
             FrugalMapStoreState frugalMapStoreState = this._mapStore.InsertEntry(key, value);
             if (frugalMapStoreState == FrugalMapStoreState.Success)
             {
                 return;
             }
             FrugalMapBase newMap;
             if (FrugalMapStoreState.ThreeObjectMap == frugalMapStoreState)
             {
                 newMap = (FrugalMapBase) new ThreeObjectMap();
             }
             else if (FrugalMapStoreState.SixObjectMap == frugalMapStoreState)
             {
                 newMap = (FrugalMapBase) new SixObjectMap();
             }
             else if (FrugalMapStoreState.Array == frugalMapStoreState)
             {
                 newMap = (FrugalMapBase) new ArrayObjectMap();
             }
             else if (FrugalMapStoreState.SortedArray == frugalMapStoreState)
             {
                 newMap = (FrugalMapBase) new SortedObjectMap();
             }
             else
             {
                 if (FrugalMapStoreState.Hashtable != frugalMapStoreState)
                 {
                     throw new InvalidOperationException("CannotPromoteBeyondHashtable");
                 }
                 newMap = (FrugalMapBase) new HashObjectMap();
             }
             this._mapStore.Promote(newMap);
             this._mapStore = newMap;
             int num = (int)this._mapStore.InsertEntry(key, value);
         }
         else
         {
             if (this._mapStore == null)
             {
                 return;
             }
             this._mapStore.RemoveEntry(key);
             if (this._mapStore.Count != 0)
             {
                 return;
             }
             this._mapStore = (FrugalMapBase)null;
         }
     }
 }