wasSharp – Diff between revs 39 and 44

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 39 Rev 44
Line 11... Line 11...
11   11  
12 namespace wasSharp.Collections.Specialized 12 namespace wasSharp.Collections.Specialized
13 { 13 {
14 public class MultiKeyDictionary<K1, K2, V> : Dictionary<K1, Dictionary<K2, V>> 14 public class MultiKeyDictionary<K1, K2, V> : Dictionary<K1, Dictionary<K2, V>>
15 { 15 {
Line 16... Line 16...
16 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 16 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
17   17  
18 public V this[K1 key1, K2 key2] 18 public V this[K1 key1, K2 key2]
19 { 19 {
20 get 20 get
-   21 {
-   22 _lock.EnterReadLock();
21 { 23 try
-   24 {
-   25 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
-   26 {
-   27 return default(V);
-   28 }
-   29 return base[key1][key2];
22 SyncRoot.EnterReadLock(); 30 }
23 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2)) 31 finally
24 { -  
25 SyncRoot.ExitReadLock(); 32 {
26 return default(V); -  
27 } -  
28 var v = base[key1][key2]; -  
29 SyncRoot.ExitReadLock(); 33 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
30 return v; 34 }
31 } 35 }
32 set 36 set
-   37 {
-   38 _lock.EnterWriteLock();
33 { 39 try
34 SyncRoot.EnterWriteLock(); 40 {
Line 35... Line 41...
35 if (!ContainsKey(key1)) 41 if (!ContainsKey(key1))
-   42 this[key1] = new Dictionary<K2, V>();
-   43  
-   44 this[key1][key2] = value;
36 this[key1] = new Dictionary<K2, V>(); 45 }
-   46 finally
37   47 {
38 this[key1][key2] = value; 48 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
Line 39... Line 49...
39 SyncRoot.ExitWriteLock(); 49 }
40 } 50 }
41 } 51 }
42   52  
43 public new IEnumerable<V> Values 53 public new IEnumerable<V> Values
-   54 {
-   55 get
44 { 56 {
-   57 _lock.EnterReadLock();
-   58 try
-   59 {
45 get 60 return base.Values.SelectMany(baseDict => baseDict.Keys, (baseDict, baseKey) => baseDict[baseKey]);
46 { 61 }
47 SyncRoot.EnterReadLock(); 62 finally
48 var v = base.Values.SelectMany(baseDict => baseDict.Keys, (baseDict, baseKey) => baseDict[baseKey]); 63 {
Line 49... Line 64...
49 SyncRoot.ExitReadLock(); 64 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
50 return v; 65 }
51 } 66 }
-   67 }
-   68  
52 } 69 public void Add(K1 key1, K2 key2, V value)
53   70 {
Line 54... Line 71...
54 public void Add(K1 key1, K2 key2, V value) 71 _lock.EnterWriteLock();
-   72 try
-   73 {
-   74 if (!ContainsKey(key1))
55 { 75 this[key1] = new Dictionary<K2, V>();
-   76  
56 SyncRoot.EnterWriteLock(); 77 this[key1][key2] = value;
Line 57... Line 78...
57 if (!ContainsKey(key1)) 78 }
58 this[key1] = new Dictionary<K2, V>(); 79 finally
59   80 {
60 this[key1][key2] = value; 81 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
61 SyncRoot.ExitWriteLock(); 82 }
-   83 }
-   84  
-   85 public void Remove(K1 key1, K2 key2)
-   86 {
62 } 87 _lock.EnterWriteLock();
63   88 try
-   89 {
-   90 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
-   91 {
-   92 return;
64 public void Remove(K1 key1, K2 key2) 93 }
65 { -  
66 SyncRoot.EnterWriteLock(); -  
67 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2)) -  
68 { 94 this[key1].Remove(key2);
Line 69... Line 95...
69 SyncRoot.ExitWriteLock(); 95 Remove(key1);
70 return; 96 }
71 } 97 finally
-   98 {
-   99 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
72 this[key1].Remove(key2); 100 }
-   101 }
-   102  
-   103 public bool ContainsKey(K1 key1, K2 key2)
73 Remove(key1); 104 {
74 SyncRoot.ExitWriteLock(); 105 _lock.EnterReadLock();
75 } 106 try
Line 76... Line 107...
76   107 {
77 public bool ContainsKey(K1 key1, K2 key2) 108 return ContainsKey(key1) && this[key1].ContainsKey(key2);
78 { 109 }
79 SyncRoot.EnterReadLock(); 110 finally
80 var c = ContainsKey(key1) && this[key1].ContainsKey(key2); 111 {
-   112 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
81 SyncRoot.ExitReadLock(); 113 }
82 return c; 114 }
83 } 115  
84   116 public bool TryGetValue(K1 key1, K2 key2, out V value)
85 public bool TryGetValue(K1 key1, K2 key2, out V value) 117 {
86 { 118 _lock.EnterReadLock();
-   119 try
87 SyncRoot.EnterReadLock(); 120 {
-   121 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
-   122 {
-   123 value = default(V);
88 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2)) 124 return false;
89 { 125 }
Line 90... Line 126...
90 SyncRoot.ExitReadLock(); 126 value = base[key1][key2];
91 value = default(V); 127 return true;
92 return false; 128 }
Line 93... Line 129...
93 } 129 finally
94 value = base[key1][key2]; 130 {
95 SyncRoot.ExitReadLock(); 131 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
96 return true; 132 }
97 } 133 }
-   134 }
-   135  
98 } 136 public class MultiKeyDictionary<K1, K2, K3, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, V>>
-   137 {
-   138 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
-   139  
99   140 public V this[K1 key1, K2 key2, K3 key3]
100 public class MultiKeyDictionary<K1, K2, K3, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, V>> 141 {
101 { 142 get
102 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 143 {
103   144 _lock.EnterReadLock();
104 public V this[K1 key1, K2 key2, K3 key3] 145 try
-   146 {
-   147 return ContainsKey(key1) ? this[key1][key2, key3] : default(V);
105 { 148 }
106 get 149 finally
-   150 {
107 { 151 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   152 }
-   153 }
-   154 set
108 SyncRoot.EnterReadLock(); 155 {
-   156 _lock.EnterWriteLock();
109 var v = ContainsKey(key1) ? this[key1][key2, key3] : default(V); 157 try
110 SyncRoot.ExitReadLock(); 158 {
Line 111... Line 159...
111 return v; 159 if (!ContainsKey(key1))
112 } 160 this[key1] = new MultiKeyDictionary<K2, K3, V>();
113 set 161  
-   162 this[key1][key2, key3] = value;
-   163 }
114 { 164 finally
-   165 {
-   166 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
-   167 }
115 SyncRoot.EnterWriteLock(); 168 }
116 if (!ContainsKey(key1)) 169 }
117 this[key1] = new MultiKeyDictionary<K2, K3, V>(); 170  
Line 118... Line 171...
118 this[key1][key2, key3] = value; 171 public bool ContainsKey(K1 key1, K2 key2, K3 key3)
119 SyncRoot.ExitWriteLock(); 172 {
120 } 173 _lock.EnterReadLock();
-   174 try
-   175 {
121 } 176 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3);
122   177 }
123 public bool ContainsKey(K1 key1, K2 key2, K3 key3) 178 finally
-   179 {
-   180 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   181 }
124 { 182 }
-   183  
125 SyncRoot.EnterReadLock(); 184 public void Add(K1 key1, K2 key2, K3 key3, V value)
Line 126... Line 185...
126 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3); 185 {
127 SyncRoot.ExitReadLock(); 186 _lock.EnterWriteLock();
128 return c; 187 try
129 } 188 {
130   189 if (!ContainsKey(key1))
-   190 this[key1] = new MultiKeyDictionary<K2, K3, V>();
-   191 this[key1][key2, key3] = value;
-   192 }
-   193 finally
-   194 {
131 public void Add(K1 key1, K2 key2, K3 key3, V value) 195 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
132 { 196 }
-   197 }
-   198  
-   199 public void Remove(K1 key1, K2 key2, K3 key3)
-   200 {
133 SyncRoot.EnterWriteLock(); 201 _lock.EnterWriteLock();
134 if (!ContainsKey(key1)) -  
135 this[key1] = new MultiKeyDictionary<K2, K3, V>(); -  
136 this[key1][key2, key3] = value; -  
137 SyncRoot.ExitWriteLock(); -  
138 } 202 try
Line 139... Line 203...
139   203 {
140 public void Remove(K1 key1, K2 key2, K3 key3) 204 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3))
141 { 205 {
142 SyncRoot.EnterWriteLock(); 206 return;
143 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3)) 207 }
-   208 this[key1][key2].Remove(key3);
144 { 209 this[key1].Remove(key2);
145 SyncRoot.ExitWriteLock(); 210 Remove(key1);
146 return; 211 }
147 } 212 finally
148 this[key1][key2].Remove(key3); 213 {
149 this[key1].Remove(key2); 214 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
-   215 }
150 Remove(key1); 216 }
-   217  
-   218 public bool TryGetValue(K1 key1, K2 key2, K3 key3, out V value)
-   219 {
151 SyncRoot.ExitWriteLock(); 220 _lock.EnterReadLock();
152 } 221 try
Line 153... Line 222...
153   222 {
154 public bool TryGetValue(K1 key1, K2 key2, K3 key3, out V value) 223 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3))
155 { 224 {
Line 156... Line 225...
156 SyncRoot.EnterReadLock(); 225 value = default(V);
157 if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3)) 226 return false;
158 { 227 }
159 SyncRoot.ExitReadLock(); 228 value = base[key1][key2, key3];
160 value = default(V); 229 return true;
-   230 }
-   231 finally
161 return false; 232 {
-   233 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   234 }
-   235 }
162 } 236 }
163 value = base[key1][key2, key3]; 237  
164 SyncRoot.ExitReadLock(); 238 public class MultiKeyDictionary<K1, K2, K3, K4, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, K4, V>>
165 return true; 239 {
166 } 240 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
167 } 241  
-   242 public V this[K1 key1, K2 key2, K3 key3, K4 key4]
-   243 {
168   244 get
169 public class MultiKeyDictionary<K1, K2, K3, K4, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, K4, V>> 245 {
170 { 246 _lock.EnterReadLock();
-   247 try
-   248 {
-   249 return ContainsKey(key1) ? this[key1][key2, key3, key4] : default(V);
171 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 250 }
-   251 finally
172   252 {
173 public V this[K1 key1, K2 key2, K3 key3, K4 key4] 253 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
Line 174... Line 254...
174 { 254 }
175 get 255 }
176 { 256 set
-   257 {
-   258 _lock.EnterWriteLock();
177 SyncRoot.EnterReadLock(); 259 try
-   260 {
-   261 if (!ContainsKey(key1))
-   262 this[key1] = new MultiKeyDictionary<K2, K3, K4, V>();
178 var v = ContainsKey(key1) ? this[key1][key2, key3, key4] : default(V); 263 this[key1][key2, key3, key4] = value;
179 SyncRoot.ExitReadLock(); 264 }
180 return v; 265 finally
181 } 266 {
Line 182... Line 267...
182 set 267 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
183 { 268 }
184 SyncRoot.EnterWriteLock(); 269 }
Line 185... Line 270...
185 if (!ContainsKey(key1)) 270 }
186 this[key1] = new MultiKeyDictionary<K2, K3, K4, V>(); 271  
187 this[key1][key2, key3, key4] = value; 272 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4)
188 SyncRoot.ExitWriteLock(); 273 {
189 } 274 _lock.EnterReadLock();
-   275 try
-   276 {
190 } 277 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4);
-   278 }
-   279 finally
-   280 {
191   281 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
192 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4) 282 }
193 { 283 }
194 SyncRoot.EnterReadLock(); 284 }
195 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4); 285  
196 SyncRoot.ExitReadLock(); 286 public class MultiKeyDictionary<K1, K2, K3, K4, K5, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, V>>
-   287 {
-   288 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
197 return c; 289  
198 } 290 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5]
199 } 291 {
-   292 get
-   293 {
-   294 _lock.EnterReadLock();
200   295 try
-   296 {
201 public class MultiKeyDictionary<K1, K2, K3, K4, K5, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, V>> 297 return ContainsKey(key1) ? this[key1][key2, key3, key4, key5] : default(V);
202 { 298 }
Line 203... Line 299...
203 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 299 finally
204   300 {
205 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5] 301 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   302 }
-   303 }
206 { 304 set
-   305 {
-   306 _lock.EnterWriteLock();
-   307 try
207 get 308 {
208 { 309 if (!ContainsKey(key1))
209 SyncRoot.EnterReadLock(); 310 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, V>();
210 var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5] : default(V); 311 this[key1][key2, key3, key4, key5] = value;
Line 211... Line 312...
211 SyncRoot.ExitReadLock(); 312 }
212 return v; 313 finally
213 } 314 {
214 set 315 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
Line 215... Line 316...
215 { 316 }
216 SyncRoot.EnterWriteLock(); 317 }
217 if (!ContainsKey(key1)) 318 }
218 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, V>(); 319  
219 this[key1][key2, key3, key4, key5] = value; 320 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5)
-   321 {
-   322 _lock.EnterReadLock();
220 SyncRoot.ExitWriteLock(); 323 try
-   324 {
-   325 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5);
-   326 }
221 } 327 finally
222 } 328 {
223   329 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
224 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5) 330 }
225 { 331 }
226 SyncRoot.EnterReadLock(); 332 }
-   333  
-   334 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, V> :
227 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5); 335 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, V>>
228 SyncRoot.ExitReadLock(); 336 {
229 return c; 337 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
-   338  
-   339 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6]
-   340 {
230 } 341 get
-   342 {
231 } 343 _lock.EnterReadLock();
232   344 try
Line 233... Line 345...
233 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, V> : 345 {
234 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, V>> 346 return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6] : default(V);
235 { 347 }
-   348 finally
-   349 {
236 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 350 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   351 }
-   352 }
-   353 set
237   354 {
238 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6] 355 _lock.EnterWriteLock();
239 { 356 try
240 get 357 {
Line 241... Line 358...
241 { 358 if (!ContainsKey(key1))
242 SyncRoot.EnterReadLock(); 359 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, V>();
243 var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6] : default(V); 360 this[key1][key2, key3, key4, key5, key6] = value;
244 SyncRoot.ExitReadLock(); 361 }
Line 245... Line 362...
245 return v; 362 finally
246 } 363 {
247 set 364 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
248 { 365 }
249 SyncRoot.EnterWriteLock(); 366 }
-   367 }
-   368  
250 if (!ContainsKey(key1)) 369 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6)
-   370 {
-   371 _lock.EnterReadLock();
-   372 try
251 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, V>(); 373 {
252 this[key1][key2, key3, key4, key5, key6] = value; 374 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6);
253 SyncRoot.ExitWriteLock(); 375 }
254 } 376 finally
255 } 377 {
256   378 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   379 }
-   380 }
257 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6) 381 }
258 { 382  
259 SyncRoot.EnterReadLock(); 383 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, V> :
-   384 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>>
-   385 {
-   386 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
260 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6); 387  
-   388 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7]
261 SyncRoot.ExitReadLock(); 389 {
262 return c; 390 get
Line 263... Line 391...
263 } 391 {
264 } 392 _lock.EnterReadLock();
265   393 try
-   394 {
-   395 return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7] : default(V);
266 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, V> : 396 }
-   397 finally
-   398 {
-   399 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
267 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>> 400 }
268 { 401 }
269 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 402 set
270   403 {
Line 271... Line 404...
271 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7] 404 _lock.EnterWriteLock();
272 { 405 try
273 get 406 {
274 { 407 if (!ContainsKey(key1))
Line 275... Line 408...
275 SyncRoot.EnterReadLock(); 408 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>();
276 var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7] : default(V); 409 this[key1][key2, key3, key4, key5, key6, key7] = value;
277 SyncRoot.ExitReadLock(); 410 }
278 return v; 411 finally
279 } 412 {
-   413 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
-   414 }
280 set 415 }
-   416 }
-   417  
-   418 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7)
281 { 419 {
282 SyncRoot.EnterWriteLock(); 420 _lock.EnterReadLock();
283 if (!ContainsKey(key1)) 421 try
284 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>(); 422 {
285 this[key1][key2, key3, key4, key5, key6, key7] = value; 423 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7);
286 SyncRoot.ExitWriteLock(); 424 }
-   425 finally
-   426 {
287 } 427 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
288 } 428 }
289   429 }
-   430 }
-   431  
-   432 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, V> :
290 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7) 433 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>>
-   434 {
291 { 435 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
292 SyncRoot.EnterReadLock(); 436  
Line 293... Line 437...
293 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7); 437 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8]
294 SyncRoot.ExitReadLock(); 438 {
295 return c; 439 get
-   440 {
-   441 _lock.EnterReadLock();
296 } 442 try
-   443 {
-   444 return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8] : default(V);
-   445 }
297 } 446 finally
298   447 {
299 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, V> : 448 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
300 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>> 449 }
Line 301... Line 450...
301 { 450 }
302 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 451 set
303   452 {
304 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8] 453 _lock.EnterWriteLock();
Line 305... Line 454...
305 { 454 try
306 get 455 {
307 { 456 if (!ContainsKey(key1))
308 SyncRoot.EnterReadLock(); 457 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>();
309 var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8] : default(V); 458 this[key1][key2, key3, key4, key5, key6, key7, key8] = value;
-   459 }
-   460 finally
310 SyncRoot.ExitReadLock(); 461 {
-   462 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
-   463 }
-   464 }
311 return v; 465 }
312 } 466  
313 set 467 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8)
314 { 468 {
315 SyncRoot.EnterWriteLock(); 469 _lock.EnterReadLock();
316 if (!ContainsKey(key1)) 470 try
-   471 {
-   472 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8);
317 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>(); 473 }
318 this[key1][key2, key3, key4, key5, key6, key7, key8] = value; 474 finally
319 SyncRoot.ExitWriteLock(); 475 {
-   476 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   477 }
-   478 }
320 } 479 }
-   480  
321 } 481 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, V> :
322   482 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>>
Line 323... Line 483...
323 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8) 483 {
324 { 484 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
325 SyncRoot.EnterReadLock(); 485  
-   486 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9]
-   487 {
326 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8); 488 get
-   489 {
-   490 _lock.EnterReadLock();
-   491 try
327 SyncRoot.ExitReadLock(); 492 {
328 return c; 493 return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9] : default(V);
329 } 494 }
330 } 495 finally
Line 331... Line 496...
331   496 {
332 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, V> : 497 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
333 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>> 498 }
334 { 499 }
Line 335... Line 500...
335 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 500 set
336   501 {
337 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9] 502 _lock.EnterWriteLock();
338 { 503 try
339 get 504 {
-   505 if (!ContainsKey(key1))
-   506 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>();
-   507 this[key1][key2, key3, key4, key5, key6, key7, key8, key9] = value;
340 { 508 }
341 SyncRoot.EnterReadLock(); 509 finally
-   510 {
342 var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9] : default(V); 511 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
-   512 }
-   513 }
-   514 }
343 SyncRoot.ExitReadLock(); 515  
344 return v; 516 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9)
345 } 517 {
346 set 518 _lock.EnterReadLock();
-   519 try
-   520 {
347 { 521 return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9);
348 SyncRoot.EnterWriteLock(); 522 }
349 if (!ContainsKey(key1)) 523 finally
-   524 {
-   525 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   526 }
350 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>(); 527 }
-   528 }
351 this[key1][key2, key3, key4, key5, key6, key7, key8, key9] = value; 529  
352 SyncRoot.ExitWriteLock(); 530 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, V> :
Line 353... Line 531...
353 } 531 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>>
354 } 532 {
355   533 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
356 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9) 534  
-   535 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9, K10 key10]
-   536 {
357 { 537 get
358 SyncRoot.EnterReadLock(); 538 {
-   539 _lock.EnterReadLock();
-   540 try
-   541 {
359 var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9); 542 return ContainsKey(key1)
360 SyncRoot.ExitReadLock(); 543 ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10]
361 return c; 544 : default(V);
362 } 545 }
Line 363... Line 546...
363 } 546 finally
364   547 {
365 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, V> : 548 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
366 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>> 549 }
Line 367... Line 550...
367 { 550 }
368 private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 551 set
369   552 {
370 public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9, K10 key10] 553 _lock.EnterWriteLock();
371 { 554 try
372 get 555 {
-   556 if (!ContainsKey(key1))
-   557 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>();
373 { 558 this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10] = value;
374 SyncRoot.EnterReadLock(); 559 }
375 var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10] : default(V); 560 finally
-   561 {
-   562 if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
-   563 }
376 SyncRoot.ExitReadLock(); 564 }
377 return v; 565 }
378 } 566  
379 set 567 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9,
380 { 568 K10 key10)
381 SyncRoot.EnterWriteLock(); 569 {
-   570 _lock.EnterReadLock();
-   571 try
382 if (!ContainsKey(key1)) 572 {
383 this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>(); 573 return ContainsKey(key1) &&
384 this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10] = value; 574 this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9, key10);
-   575 }
-   576 finally
-   577 {
385 SyncRoot.ExitWriteLock(); 578 if (_lock.IsReadLockHeld) _lock.ExitReadLock();
-   579 }
386 } 580 }
387 } 581 }
Line 388... Line 582...
388   582  
389 public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9, 583 public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, K11, V> :
390 K10 key10) 584 Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, K11, V>>
391 { 585 {
-   586 private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
-   587  
392 SyncRoot.EnterReadLock(); 588 public V this[
393 var c = ContainsKey(key1) && 589 K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9, K10 key10, K11 key11]
-   590 {
-   591 get
-   592 {
394 this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9, key10); 593 _lock.EnterReadLock();
395 SyncRoot.ExitReadLock(); 594 try
396 return c; 595 {
397 } 596 return ContainsKey(key1)
398 } 597 ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10, key11]