Just to add to my previous blog abt Generics Overloading the folowing scenarion is also very helpful.....
Suppose I have a class
public class
TestClass<T, U>
{
public void Foo<I>(T val1, I val2, U val3) { }
public void Foo<I>(U val1, T val2, I val3) { }
}
And I'm calling this as
static
void Main(string[] args)
{
TestClass<int, string> ob = new TestClass<int, string>();
ob.Foo<
double>(1, 122223, "er");
}
it will compile pefectly as the permutations of U,T,and I are always unique....However if the call would be
static void Main(string[] args)
{
TestClass<int, int> ob = new TestClass<int, int>();
ob.Foo<
double>(1, 122223, 2);
}
it would give a compile error.