Browse files

add array accessors tzo InstanceCollection

  • Loading branch information...
1 parent 92a2b29 commit 05413ce1299af24ea9e22dcfcc4aa41272c52f2a @maul-esel committed Apr 21, 2012
Showing with 34 additions and 0 deletions.
  1. +34 −0 ChameleonCoder.Core/InstanceCollection.cs
View
34 ChameleonCoder.Core/InstanceCollection.cs
@@ -73,5 +73,39 @@ public TValue GetInstance(TKey key)
instances.AddOrUpdate(key, value, (k, v) => value);
}
}
+
+ public TValue[] Values
+ {
+ get
+ {
+ TValue[] array = new TValue[instances.Values.Count];
+
+ int index = 0;
+ foreach (TValue value in instances.Values)
+ {
+ array[index] = value;
+ index++;
+ }
+
+ return array;
+ }
+ }
+
+ public TKey[] Keys
+ {
+ get
+ {
+ TKey[] array = new TKey[instances.Keys.Count];
+
+ int index = 0;
+ foreach (TKey key in instances.Keys)
+ {
+ array[index] = key;
+ index++;
+ }
+
+ return array;
+ }
+ }
}
}

0 comments on commit 05413ce

Please sign in to comment.