Answer Posted / wasimhajwane
lambda expression :
Lambda expression is introduce in c# version 3.0.Its a method without having declaration,
A lambda expression is a anonymous function mostly used to create delegate in LINQ.
Syntax:
parameter => expression or statement block.
simple program to understand lambda expreesion
class A
{
// we have to declare delegate here
public delegate int B(int a);
static void main()
{
B b=a=>a*a;
int res=b(5);
Console.WriteLine("result = ",res);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the usage of Enumeration in C# Programming and is it good to use or not ?
What is iqueryable and ienumerable in c#?
How do you escape a character?
What is platform independence"?
What is the difference between the debug class and trace class? Documentation looks the same.
Can a string be null c#?
What is dapper in c#?
Are constructors inherited c#?
Can a static class contain non static members?
If you define a user defined data type by using the class keyword, is it a value type or reference type?
Can abstract class have constructor c#?
Is xamarin free?
Why is c# a good programming language?
What is the difference between int and int in c#?
How does return work in c#?