t1 / TFDContents / Assets / Standard Assets / CollectionMap.cs @ 9
이력 | 보기 | 이력해설 | 다운로드 (669 Bytes)
1 | 3 | KTH | #if !(UNITY_WSA_10_0 && NETFX_CORE) |
---|---|---|---|
2 | using System; |
||
3 | using System.Collections.Generic; |
||
4 | using System.Linq; |
||
5 | using System.Text; |
||
6 | |||
7 | namespace Helper |
||
8 | { |
||
9 | class CollectionMap<TKey, TValue> : Helper.ThreadSafeDictionary<TKey, TValue> where TValue : new() |
||
10 | { |
||
11 | public bool TryAddDefault(TKey key) |
||
12 | { |
||
13 | lock (_impl) |
||
14 | { |
||
15 | if (!_impl.ContainsKey(key)) |
||
16 | { |
||
17 | _impl.Add(key, new TValue()); |
||
18 | return true; |
||
19 | } |
||
20 | else |
||
21 | { |
||
22 | return false; |
||
23 | } |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 | #endif |