I usually create strongly typed collections that inherit from
CollectionBase. It has an InnerList property that stores items by index.
In that strongly typed collection I create a private variable of type
HashTable.
When adding I add to both the InnerList and the HashTable. When getting by
index I get from InnerlList, and when getting by key I get by the HashTable.
CollectionBase is bindable to the built in controls (DataGrid, etc..) in the
same way as a DataSet. It would be best NOT to bind a DataSet directly to a
DataGrid in edit mode if you want to do any business rules validation on the
entered data. However, A strongly typed Collection can contain your
business validation logic.
Performance is comparable to other collections. It may use a little extra
memory, since it stores 2 references (not objects) for each object instead
of 1. What you gain is the ability to reference an item by index or key.
I don't know of any built in type in the collections namespace that does
this with good performance when containing more than 10 items.
I demonstrate this method in an open source project in SourceForge ...
http://sourceforge.net/projects/dbobjecter
....which will generate code for your objects from a database. Use
"Template04" and look at results in the Business layer.
Mike