My requirements:
- I need to store a collection of objects inside a class,
objects must be accessible by their key (which will be unique string), search/remove/replace must work like this
MyClass somethingNew = new MyClass(); // set someproperties on somethingNew somethingNew.Id = "FooBar"; // theOtherObject already contains an object with the key "FooBar" theOtherObject.Members[somethingNew.Id] = somethingNew;
when new object is inserted no sort should happen,
- the property (collection) must be serializable to XML using DataContractSerializer.
So, what to choose for Members property? I guess that List and SortedList are out of the question, so I am about to use generic
Dictionary<string, MyClass>.
Is this the right decision? Does it support serialization?