What is Anonymous functions ?

 Posted by Niladri.Biswas on 7/21/2012 | Category: C# Interview questions | Views: 3700 | Points: 40

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

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 

Comments or Responses

Login to post response