Generic Classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Generic Classes

I've tried to understand generic classes but i couldn't understand it perfectly..who can help me

15th Feb 2019, 4:29 PM
Manhal EB 🔰
Manhal EB 🔰 - avatar
1 Answer
+ 1
A generic class is just a class that can hold any type of data. The best generic class is list List<string> stringlist = new List<string>(); List<int> stringlist = new List<int>(); List<MyClass> stringlist = new List<MyClass>(); Generic is not free. You need to tell the compiler which type you are using. But with list you are able to use the same type for lots of different data types.
15th Feb 2019, 8:53 PM
sneeze
sneeze - avatar