public class clsGeneric
{
public void show<T>(T value)
{
Type t = typeof(T);
Console.WriteLine(t.Name + ":" + value);
}
}
class Program
{
static void Main(string[] args)
{
clsGeneric ng;
ng = new clsGeneric();
int a = 10;
ng.show(a);
string b = "SS";
ng.show(b);
Console.WriteLine("Press any key to close........");
Console.ReadKey();
}
}
OUTPUT
----------------------------
Int32:10
String:SS
Press any key to close........