Anonymous Methods in C# An anonymous method is a method which doesn’t contain any name, it is introduced in C# 2.0 . It is useful when the user wants to create an inline method and also wants to pass parameter in the anonymous method like other methods. An Anonymous method is defined using the delegate keyword and the user can assign this method to a variable of the delegate type. Syntax of Anonymous method Anonymous methods are declared with the creation of the delegate instance, with a delegate keyword. For example delegate(parameterList) { // Code.. }; Example of Anonymous method using System; namespace LegalManagementSystem.Models { public delegate void CsharpArticle ( string article); public class CsharpnaijaAnonymous { public static void Main() ...
Csharp Naija is a blog that teaches C# programming using a practical guide. C# Nigeria is here to guide interested individual to the world of software Engineering.