Just a general curiosity question. Why is this namespace “System.Collections.Generic” added by default in Visual Studio when we create the project instead of let’s say “System.Collections”?
Is Collection Classes under generics is most preferred way than the Collection Classes in the System.Collections?
Thanks
Harsha
Yes, generics collection are better than regular collection because they bring strong typing, which prevent boxing and unboxing, and all those annoying casting.
There are few reason left to use a regular collection. Even if you don’t know which type of object that you are storing, you can still use something like
List<object>.