Answer: An anonymous function is an "inline" statement or expression that can be used wherever a delegate type is expected. We can use it to initialize a named delegate or pass it instead of a named delegate type as a method parameter
e.g.
In C# 2.0:
var output = doSomething(variable, delegate {
// Anonymous function code
});
In C#4.0:
var output = doSomething(variable, () => {
// Anonymous function code
});
Asked In: Many Interviews |
Alert Moderator