P
Piotrekk
Hi
I have a question which was puzzling me today.
1 static void Main(string[] args)
2 {
3 Foo(delegate { return x; });
4 }
5
6 static void Foo(Func<int,int> action)
7 {
8 Console.WriteLine("I suspect the anonymous method...");
9 }
The argument of Foo can be either Func<int> or Func<int>. I have no
idea why. We are not passing any arguments in line 3. What does the
compiler do in this case?
Kind Regards
Piotr Ko³odziej
I have a question which was puzzling me today.
1 static void Main(string[] args)
2 {
3 Foo(delegate { return x; });
4 }
5
6 static void Foo(Func<int,int> action)
7 {
8 Console.WriteLine("I suspect the anonymous method...");
9 }
The argument of Foo can be either Func<int> or Func<int>. I have no
idea why. We are not passing any arguments in line 3. What does the
compiler do in this case?
Kind Regards
Piotr Ko³odziej