So I'm a newbie, i was trying few things out, and I can't understand why the type can't be infered from the Test method, but can be infered from lambda expression.
class Program
{
public delegate T2 DelegateTest<T1, T2>(T1 t1, T2 t2);
public static T2 GenericMethodPlusDelegate<T1, T2>(DelegateTest<T1, T2> del)
{
return default;
}
static void Main(string[] args)
{
GenericMethodPlusDelegate(Test); //type cannot be infered, won't compile
GenericMethodPlusDelegate((int x, char y) => y); //compiles
}
public static char Test(int x, char y)
{
return y;
}
}