I am migrating a 1.1 winforms app to 2.0. what are the main things i should immediately change because of generics. Here what i have so far:
- Replace all hashtables with generic dictionaries
- Replace all arraylists with List<>
- Replace all CollectionBase derive classes with : List<>
Any others that should be done immediately?
thks, ak
Generally, change any mention of
IEnumerabletoIEnumerable<T>, where possible. Migration can be greatly helped by switching the whole namespace, i.e. un-importingSystem.Collectionsin every file and instead importingSystem.Collections.Generic.Also, search for mentions of
objectand/or usage of boxing in your code and consider whether this is still appropriate or should be replaced by generics.As jalf reminded me in the comments, another important change is the switch to the generic version of
IComparablewhere applicable.