0
Why bother using generics when we can use var type? Im asking about c#
Hello guys I just wanted to know that why should we go through all that trouble and use generics when we can just use type var whenever we dont know what is the type of the variable that is going to be passed inside the method? Note that im asking about c#
3 Answers
+ 4
Emad Always specify the language while posting a question so that it helps others to answer your question to the point, though the generic concept is pretty much the same in all languages.
+ 2
Tnx alot
Its Taken care of now
0
var covers only primitive types, while with generics, you can type cast classes, other collections as well..
I guess, there may be other reason..