Monday, July 25, 2011

Which C# collection you should use to meet your requirement?

If you want sequential access to your collection, use stack (LIFO) or queue (FIFO). If you need to access each element by index you can use an ArrayList or List.

Using HashTable and Dictionary classes you can access an item in the collection by key.

If you want to sort the list. you can use SortedList or SortedDictionary and customize the way items are sorted using the IComparer interface.

No comments:

Post a Comment