George George

George George

  • NA
  • 778
  • 0

what is method group?

Sep 10 2008 6:44 AM

Hello everyone,


After quite some time study on samples and C# Spec. I am confused about what is a method group? In my understanding method group is a set of methods which have the same signature, and not necessary to belong to a specific class. But I am not sure whether I am correct. Any comments or ideas?

Below is what I found in my study.

From ECMA-334: 14.1,

http://en.csharp-online.net/ECMA-334:_14.1_Expression_classifications

A method group, which is a set of overloaded methods resulting from a member lookup (§14.3). A method group can have an associated instance expression. When an instance method is invoked, the result of evaluating the instance expression becomes the instance represented by this (§14.5.7). A method group can be used in an invocation-expression (§14.5.5), used in a delegate-creation-expression (§14.5.10.3), or implicitly converted to a compatible delegate type. In any other context, an expression classified as a method group causes a compile-time error.

From C# in Depth,

http://csharpindepth.com/ViewNote.aspx?NoteID=92

"the feature allows you to specify an extension method as a method group using extension syntax"


thanks in advance,
George


Answers (2)