C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
3
Reply
What is anonymous method?
Vijay Kumar
11y
2.6k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
The concept of anonymous method was introduced in C# 2.0. An anonymous method is an inline unnamed method in the code. It is created using the delegate keyword and doesn't have its name and return type. In this way, an anonymous method has no name, optional parameters and return type; it has only body. An anonymous method behaves like a regular method and allows you to write inline code in place of regular method. Key points about anonymous method 1. A variable, declared outside the anonymous method can be accessed inside the anonymous method. 2. A variable, declared inside the anonymous method can't be accessed outside the anonymous method. 3. We use anonymous method in event handling. 4. An anonymous method, declared without parenthesis can be assigned to a delegate with any signature. 5. Unsafe code can't be accessed within an anonymous method. 6. An anonymous method can't access the ref or out parameters of an outer scope.
Vijay Kumar
11y
1
The customize form of anonymous method is lamda expression.It has no name and return type .It is called Inline Method.It has only Body
ragini varshney
11y
0
http://www.tutorialspoint.com/csharp/csharp_anonymous_methods.htm
Munesh Sharma
11y
0
What is dynamic Variable in C# ?
ASP.NET Web API Controller and ASP.NET MVC Controller
Message