October 29, 2005
@ 10:48 PM

All methods use a subset of elements from the same master set. In C# 2.0, the set of optional elements will grow. Historically—except in C++ inline methods—methods required a name, a return type, and a body. Optionally, methods could use an access modifier and a parameter list. In C# 2.0, the method name has been moved from the list of required items to the list of optional items.


C# 2.0 (and .NET in general) introduces the anonymous method. An anonymous method can be used anywhere a delegate is used and is defined inline, without a method name, with optional parameters and a method body.


To use anonymous methods, you need to know what a delegate is, so we'll review delegates briefly before getting into when to use anonymous methods and about anonymous method limitations.


Read More