Possible Duplicate:
C# 3.0 generic type inference - passing a delegate as a function parameter
Why can't the type arguments of the following code sample in the call in Main
be inferred?
using System;
class Program
{
static void Main(string[] args)
{
Method(Action);
}
static void Action(int arg)
{
// ...
}
static void Method<T>(Action<T> action)
{
// ...
}
}
This gives the following error message:
error CS0411: The type arguments for method
Program.Method<T>(System.Action<T>)
cannot be inferred from the usage. Try specifying the type arguments explicitly.