Generic is a concept that allows us to define classes and methods with placeholder. C# compiler replaces these placeholders with specified type at compile time. The concept of generics is used to create general purpose classes and methods.
o define generic class, we must use angle <> brackets. The angle brackets are used to declare a class or method as generic type. In the following example, we are creating generic class that can be used to deal with any type of data.
C# Generic class example
This is generic class 101 I
C# allows us to create generic methods also. In the following example, we are creating generic method that can be called by passing any type of argument.
Generic Method Example
This is generic method 101 I
Next TopicC# Delegates