wasSharp

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 43  →  ?path2? @ 44
/Collections/Specialized/MultiKeyDictionary.cs
@@ -13,30 +13,40 @@
{
public class MultiKeyDictionary<K1, K2, V> : Dictionary<K1, Dictionary<K2, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2]
{
get
{
SyncRoot.EnterReadLock();
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
_lock.EnterReadLock();
try
{
SyncRoot.ExitReadLock();
return default(V);
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
{
return default(V);
}
return base[key1][key2];
}
var v = base[key1][key2];
SyncRoot.ExitReadLock();
return v;
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new Dictionary<K2, V>();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new Dictionary<K2, V>();
 
this[key1][key2] = value;
SyncRoot.ExitWriteLock();
this[key1][key2] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
@@ -44,189 +54,280 @@
{
get
{
SyncRoot.EnterReadLock();
var v = base.Values.SelectMany(baseDict => baseDict.Keys, (baseDict, baseKey) => baseDict[baseKey]);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return base.Values.SelectMany(baseDict => baseDict.Keys, (baseDict, baseKey) => baseDict[baseKey]);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
public void Add(K1 key1, K2 key2, V value)
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new Dictionary<K2, V>();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new Dictionary<K2, V>();
 
this[key1][key2] = value;
SyncRoot.ExitWriteLock();
this[key1][key2] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
 
public void Remove(K1 key1, K2 key2)
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
_lock.EnterWriteLock();
try
{
SyncRoot.ExitWriteLock();
return;
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
{
return;
}
this[key1].Remove(key2);
Remove(key1);
}
this[key1].Remove(key2);
Remove(key1);
SyncRoot.ExitWriteLock();
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
 
public bool ContainsKey(K1 key1, K2 key2)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
 
public bool TryGetValue(K1 key1, K2 key2, out V value)
{
SyncRoot.EnterReadLock();
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
_lock.EnterReadLock();
try
{
SyncRoot.ExitReadLock();
value = default(V);
return false;
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2))
{
value = default(V);
return false;
}
value = base[key1][key2];
return true;
}
value = base[key1][key2];
SyncRoot.ExitReadLock();
return true;
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
public class MultiKeyDictionary<K1, K2, K3, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, V>();
this[key1][key2, key3] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, V>();
 
this[key1][key2, key3] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
 
public void Add(K1 key1, K2 key2, K3 key3, V value)
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, V>();
this[key1][key2, key3] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, V>();
this[key1][key2, key3] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
 
public void Remove(K1 key1, K2 key2, K3 key3)
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3))
_lock.EnterWriteLock();
try
{
SyncRoot.ExitWriteLock();
return;
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3))
{
return;
}
this[key1][key2].Remove(key3);
this[key1].Remove(key2);
Remove(key1);
}
this[key1][key2].Remove(key3);
this[key1].Remove(key2);
Remove(key1);
SyncRoot.ExitWriteLock();
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
 
public bool TryGetValue(K1 key1, K2 key2, K3 key3, out V value)
{
SyncRoot.EnterReadLock();
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3))
_lock.EnterReadLock();
try
{
SyncRoot.ExitReadLock();
value = default(V);
return false;
if (!ContainsKey(key1) || !this[key1].ContainsKey(key2, key3))
{
value = default(V);
return false;
}
value = base[key1][key2, key3];
return true;
}
value = base[key1][key2, key3];
SyncRoot.ExitReadLock();
return true;
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
public class MultiKeyDictionary<K1, K2, K3, K4, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, K4, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3, key4] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, V>();
this[key1][key2, key3, key4] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, V>();
this[key1][key2, key3, key4] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
public class MultiKeyDictionary<K1, K2, K3, K4, K5, V> : Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3, key4, key5] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, V>();
this[key1][key2, key3, key4, key5] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, V>();
this[key1][key2, key3, key4, key5] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
@@ -233,33 +334,49 @@
public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, V> :
Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, V>();
this[key1][key2, key3, key4, key5, key6] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, V>();
this[key1][key2, key3, key4, key5, key6] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
@@ -266,33 +383,49 @@
public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, V> :
Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>();
this[key1][key2, key3, key4, key5, key6, key7] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, V>();
this[key1][key2, key3, key4, key5, key6, key7] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
@@ -299,33 +432,49 @@
public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, V> :
Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
@@ -332,33 +481,49 @@
public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, V> :
Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9] : default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8, key9] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8, key9] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) && this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
@@ -365,24 +530,37 @@
public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, V> :
Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9, K10 key10]
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1) ? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10] : default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1)
? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10]
: default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
@@ -389,11 +567,16 @@
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9,
K10 key10)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) &&
this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9, key10);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) &&
this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9, key10);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
 
@@ -400,7 +583,7 @@
public class MultiKeyDictionary<K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, K11, V> :
Dictionary<K1, MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, K11, V>>
{
private readonly ReaderWriterLockSlim SyncRoot = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
 
public V this[
K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9, K10 key10, K11 key11]
@@ -407,20 +590,31 @@
{
get
{
SyncRoot.EnterReadLock();
var v = ContainsKey(key1)
? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10, key11]
: default(V);
SyncRoot.ExitReadLock();
return v;
_lock.EnterReadLock();
try
{
return ContainsKey(key1)
? this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10, key11]
: default(V);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
set
{
SyncRoot.EnterWriteLock();
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, K11, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10, key11] = value;
SyncRoot.ExitWriteLock();
_lock.EnterWriteLock();
try
{
if (!ContainsKey(key1))
this[key1] = new MultiKeyDictionary<K2, K3, K4, K5, K6, K7, K8, K9, K10, K11, V>();
this[key1][key2, key3, key4, key5, key6, key7, key8, key9, key10, key11] = value;
}
finally
{
if (_lock.IsWriteLockHeld) _lock.ExitWriteLock();
}
}
}
 
@@ -427,11 +621,16 @@
public bool ContainsKey(K1 key1, K2 key2, K3 key3, K4 key4, K5 key5, K6 key6, K7 key7, K8 key8, K9 key9,
K10 key10, K11 key11)
{
SyncRoot.EnterReadLock();
var c = ContainsKey(key1) &&
this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9, key10, key11);
SyncRoot.ExitReadLock();
return c;
_lock.EnterReadLock();
try
{
return ContainsKey(key1) &&
this[key1].ContainsKey(key2, key3, key4, key5, key6, key7, key8, key9, key10, key11);
}
finally
{
if (_lock.IsReadLockHeld) _lock.ExitReadLock();
}
}
}
}