What is the easiest way to create a dictionary that will be bound to a property of a data object? For instance. imagine that I have:
interface A
{
string Key{get;}
}
So far I:
IDictionary<string, A> dict = new Dictionary<string, A>();
void Add(A a)
{
dict[a.Key] = a;
}
A Get(string key)
{
return dict[key];
}
Is there a better way to achieve the same? (the assembly does not need to implement an IDictionary if it has the required index).
source
share