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();
2 Comments
I hope nobody actually writes code like this 😛
@Jon – yup . But its always good to know the different ways of doing things 🙂