Generics in C#

Asad Iftikhar
Jun 20, 2021

Generic means not defining to any data type you can use Class, Struct, Enum, Interface, Delegates, Predicate

Basically Generics allow you to define the specification of the data type of programming elements in a class or a method

Practical implementation of Generic

Create a Console Application

Open Class 1 and add some classess and Generic Method in it.

Open Program.cs main file and write these lines of code in it!!

Now run the application you will get the following Output

--

--