Generic Class in C#

// Generic Class In C#

// First, just try to understand the program and then read any article

// This is a simple example that I have created

 

using System;

 

public class GenericClass<T>

{

    public T value; 

    public GenericClass(T abc) //constructor

    {

        value = abc;

    }

 

    public void display() //method to display value

    {

        Console.WriteLine(value);

    } 

}

  

public class Employee

{

    public static void Main()

    {

        GenericClass<int> empid = new GenericClass<int>(10);

        empid.display(); 

        GenericClass<string> empname = new GenericClass<string>("ashok");

        empname.display();  

        Console.ReadLine();

    }

}

 

// I think you have understood, so need to explain them