+ 3
When we have use generics in project of .net?
2 Antworten
+ 1
if u mean what for generics use for in .net it is use to type Safety , Performance And reuse code .
+ 1
In modern C# you can't avoid generics and that is not a bad thing. Generics provide better run time safety. Generics prevents boxing and unboxing at run time so it is performant. Generics is reusable in the sense that if you have something "generic" that is type independent, you don't have to provide multiple versions of the same method or dare I say "copy and paste". The most common place you will see generics is IEnumerable (including any of its implementations).