class genericclass
{
private T a;
private T b;
public void sum(T val1, T val2)
{
Console.WriteLine(" sum is "+ (val1 + val2));
}
}
class Program
{
static void Main(string[] args)
{
genericclass
gcint1.sum(2, 3);
genericclass
gcfloat1.sum(2.0, 3.0);
}
}
Bechir BejaouiPosted Sep 16, 2010, 8:19 PM
Oh I suffred a lot from that in the past like you but fortunetly there is a solution to that issue in the .net 4.0 the solution is the dynamic keyword
I invite you to take a look on my article the section where I discuss the generic issue
http://www.c-sharpcorner.com/UploadFile/yougerthen/3140/Default.aspx