class worker
{
public Func<int> func1 = ()=>{ return 1; };
public int func2()
{
return 2;
}
}
static void Main(string[] args)
{
worker w = new worker();
int i = w.func1.Invoke();
int j = w.func2();
Console.WriteLine("{0}, {1}", i, j);
}
What is exactly the difference between these two calls:
Func<>
andfunc()
?
When should I use Func<>
?