If i have a method
void foo<T>(T bar){}
I can call it this way:
string s = string.Empty;
foo(s);
As I understand it, the compiler / runtime can infer a type,
However, if I change the method to this:
T foo<T,T2>(T2 bar){...}
Then I should call it "full", indicating the type of the input parameter and the type of the return value:
string s = string.Empty;
foo<int,string>(s);
Is there a way to shorten this, so I don't need to specify the type of input parameters? I.e.
foo<int>(s);
thank
source
share