Given the following MSDN sample code, why can’t I define the Action delegate “inline”:
public static void Main(string[] args)
{
Action someAction = () => Console.WriteLine("Hello from the thread pool!");
Task.Factory.StartNew(someAction);
}
…so “inline” like:
public static void Main(string[] args)
{
Task.Factory.StartNew(Action someAction = () => Console.WriteLine("etc."));
}
Thanks,
Scott
This isn’t valid C#:
Do this instead: