コード例 #1
0
ファイル: DictionaryTree.cs プロジェクト: lulzzz/BraneCloud
 /// <summary>
 /// The default indexer will try to return a Primary value from this instance.
 /// If the key isn't found, then it will look for it in parents, starting from
 /// the most recently added, and then looking backwards through other parents added earlier.
 /// Note that the "setter" for this indexer has no effect on Parents.
 /// It will only set the value in the top-level Primary dictionary.
 /// Parent and Default values, in other words, continue to "shadow" the keyed property just as before.
 /// If the property associated with a given key is shallowly removed, the shadow value comes back into view.
 /// If it is deeply removed, then the property ceases to exist at any level.
 /// </summary>
 /// <param name="key">The key used to identify a particular property.</param>
 /// <returns>
 /// The value found for the specified key.
 /// </returns>
 public TValue this[TKey key]
 {
     get { return(this[key, false]); }
     set
     {
         lock (_syncRoot)
         {
             if (_localEntries.ContainsKey(key))
             {
                 _localEntries[key] = value;
             }
             else
             {
                 _localEntries.Add(key, value);
             }
         }
     }
 }