Often, I need to create lists of data. It is obviously possible to use generic lists (List
So, we must implement our collection that inherits from CollectionBase and IEnumerable
To simplify the creation of these collections, I’ve prepared a Snippet to include in Visual Studio (Tools / Code Snippets Manager / Import). You can easily use it (Ctrl+K, Ctrl+X) and choose the name of the class… all methods are automatically adapted.
- Select the ClassCollection snippet (Ctrl+K, Ctrl+X).
- Write you class name (Employee, Department, etc).
- And use it.
Remarks: The snippet diagram class is.