The MethodSemantics table has the following columns:
-
Semantics (a 2-byte bitmask of type MethodSemanticsAttributes, §II.23.1.12)
-
Method (an index into the MethodDef table)
-
Association (an index into the Event or Property table; more precisely, a HasSemantics (§II.24.2.6) coded index)
The rows of the MethodSemantics table are filled by .property (§II.17) and .event directives (§II.18). (See §II.22.13 for more information.)
This contains informative text only.
-
MethodSemantics table can contain zero or more rows
-
Semantics shall have only those values set that are specified [ERROR]
-
Method shall index a valid row in the MethodDef table, and that row shall be for a method defined on the same class as the Property or Event this row describes [ERROR]
-
All methods for a given Property or Event shall have the same accessibility (ie the
MemberAccessMask
subfield of their Flags row) and cannot beCompilerControlled
[CLS] -
Semantics: constrained as follows:
-
If this row is for a Property, then exactly one of
Setter
,Getter
, orOther
shall be set [ERROR] -
If this row is for an Event, then exactly one of
AddOn
,RemoveOn
,Fire
, orOther
shall be set [ERROR]
-
-
If this row is for an Event, and its Semantics is
Addon
orRemoveOn
, then the row in the MethodDef table indexed by Method shall take a Delegate as a parameter, and returnvoid
[ERROR] -
If this row is for an Event, and its Semantics is
Fire
, then the row indexed in the MethodDef table by Method can return any type -
For each property, there shall be a setter, or a getter, or both [CLS]
-
Any getter method for a property whose Name is
xxx
shall be calledget_xxx
[CLS] -
Any setter method for a property whose Name is
xxx
shall be calledset_xxx
[CLS] -
If a property provides both getter and setter methods, then these methods shall have the same value in the Flags.
MemberAccessMask
subfield [CLS] -
If a property provides both getter and setter methods, then these methods shall have the same value for their Method.Flags.
Virtual
[CLS] -
Any getter and setter methods shall have Method.Flags.
SpecialName
= 1 [CLS] -
Any getter method shall have a return type which matches the signature indexed by the Property.Type field [CLS]
-
The last parameter for any setter method shall have a type which matches the signature indexed by the Property.Type field [CLS]
-
Any setter method shall have return type
ELEMENT_TYPE_VOID
(§II.23.1.16) in Method.Signature [CLS] -
If the property is indexed, the indexes for getter and setter shall agree in number and type [CLS]
-
Any AddOn method for an event whose Name is
xxx
shall have the signature:void add_xxx (
<DelegateType>handler)
(§I.10.4) [CLS] -
Any RemoveOn method for an event whose Name is
xxx
shall have the signature:void remove_xxx(
<DelegateType>handler)
(§I.10.4) [CLS] -
Any Fire method for an event whose Name is
xxx
shall have the signature:void raise_xxx(Event e)
(§I.10.4) [CLS]
End informative text.