Anonymous Delegate and Anonymous Type in C#

Below is a simple example demonstrating the usage of the Anonymous Delegate which is assigned to the Fun class.

The example demonstrates the delegate which concatenates the FirstName and last name of anonymous type and displays it

Anonymous Delegate and Anonymous Type

Func<string, string, string> FullName =

delegate(string FirstName, string LastName)

{

return FirstName + " " + LastName;

};

var Name = new { FirstName = "Senthil", LastName = "Kumar", Name = FullName };

Console.WriteLine(Name.Name);

Console.ReadLine();
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
Pin It

2 thoughts on “Anonymous Delegate and Anonymous Type in C#

Leave a Reply

Your email address will not be published. Required fields are marked *