One of the hip new features of C# 3.0 is the built in support for lambdas:
Func<int> sq = x => x * x;
sq(5); // equals 25
This is very fancy, but sometimes you need to perform a lambda that has no argument. The syntax for that is simply "()".
Func<object> doStuff = () => Console.WriteLine("stuff has been done");
doStuff();
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5