Closed
Description
Steps to Reproduce:
public static void Foo<T, U>(T value)
where T: IEnumerable<U>
{
Console.WriteLine(value.FirstOrDefault().ToString());
}
public static void Main(string[] args)
{
IEnumerable<int> x = new [] { 1, 2 };
Foo(x);
Console.ReadKey();
}
Expected Behavior:
The program compiles and runs. The type of U
is inferred to be int
, because of T: IEnumerable<U>
.
Actual Behavior:
The type arguments for method 'Scratchpad.Program.Foo<T,U>(T)' cannot be inferred from the usage. Try specifying the type arguments explicitly. (CS0411)