| | |
| | | using System; |
| | | #define emptyCreate1 |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Runtime.Serialization; |
| | |
| | | } |
| | | } |
| | | |
| | | public bool emptyCreate = true; |
| | | public bool emptyCreate = false; |
| | | //List<dict> _list = null; |
| | | public dict() : base() |
| | | { |
| | |
| | | { |
| | | get |
| | | { |
| | | if (!this.ContainsKey(key)) |
| | | { |
| | | lock (this) |
| | | { |
| | | if (!this.ContainsKey(key)) |
| | | { |
| | | if (emptyCreate) |
| | | this.Add(key, default(TValue)); |
| | | else |
| | | return default(TValue); |
| | | } |
| | | } |
| | | } |
| | | #if emptyCreate |
| | | if (!this.ContainsKey(key)) this.Add(key, default(TValue)); |
| | | |
| | | return base[key]; |
| | | |
| | | #else |
| | | return base[key]; |
| | | #endif |
| | | //if (!this.ContainsKey(key)) |
| | | //{ |
| | | // if (emptyCreate) |
| | | // { |
| | | // this.Add(key, default(TValue)); |
| | | // return base[key]; |
| | | // } |
| | | // else |
| | | // return default(TValue); |
| | | //} |
| | | //else |
| | | // return base[key]; |
| | | } |
| | | set |
| | | { |
| | | #if emptyCreate |
| | | if (!this.ContainsKey(key)) this.Add(key, default(TValue)); |
| | | |
| | | base[key] = value; |
| | | #else |
| | | base[key] = value; |
| | | #endif |
| | | |
| | | return; |
| | | if (!this.ContainsKey(key)) |
| | | { |
| | | lock (this) |
| | | if (!this.ContainsKey(key)) |
| | | { |
| | | if (!this.ContainsKey(key)) |
| | | if (emptyCreate) |
| | | { |
| | | if (emptyCreate) |
| | | this.Add(key, value); |
| | | else |
| | | return; |
| | | this.Add(key, value); |
| | | return; |
| | | } |
| | | |
| | | else |
| | | return; |
| | | } |
| | | } |
| | | base[key] = value; |
| | | else |
| | | base[key] = value; |
| | | } |
| | | |
| | | } |