Skip to content

Latest commit

 

History

History
59 lines (30 loc) · 3.52 KB

ii.22.28-methodsemantics-0x18.md

File metadata and controls

59 lines (30 loc) · 3.52 KB

II.22.28 MethodSemantics: 0x18

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 HasSemanticsII.24.2.6) coded index)

The rows of the MethodSemantics table are filled by .propertyII.17) and .event directives (§II.18). (See §II.22.13 for more information.)

This contains informative text only.

  1. MethodSemantics table can contain zero or more rows

  2. Semantics shall have only those values set that are specified [ERROR]

  3. 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]

  4. All methods for a given Property or Event shall have the same accessibility (ie the MemberAccessMask subfield of their Flags row) and cannot be CompilerControlled [CLS]

  5. Semantics: constrained as follows:

    • If this row is for a Property, then exactly one of Setter, Getter, or Other shall be set [ERROR]

    • If this row is for an Event, then exactly one of AddOn, RemoveOn, Fire, or Other shall be set [ERROR]

  6. If this row is for an Event, and its Semantics is Addon or RemoveOn, then the row in the MethodDef table indexed by Method shall take a Delegate as a parameter, and return void [ERROR]

  7. 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

  8. For each property, there shall be a setter, or a getter, or both [CLS]

  9. Any getter method for a property whose Name is xxx shall be called get_xxx [CLS]

  10. Any setter method for a property whose Name is xxx shall be called set_xxx [CLS]

  11. If a property provides both getter and setter methods, then these methods shall have the same value in the Flags.MemberAccessMask subfield [CLS]

  12. If a property provides both getter and setter methods, then these methods shall have the same value for their Method.Flags.Virtual [CLS]

  13. Any getter and setter methods shall have Method.Flags.SpecialName = 1 [CLS]

  14. Any getter method shall have a return type which matches the signature indexed by the Property.Type field [CLS]

  15. The last parameter for any setter method shall have a type which matches the signature indexed by the Property.Type field [CLS]

  16. Any setter method shall have return type ELEMENT_TYPE_VOIDII.23.1.16) in Method.Signature [CLS]

  17. If the property is indexed, the indexes for getter and setter shall agree in number and type [CLS]

  18. Any AddOn method for an event whose Name is xxx shall have the signature: void add_xxx (<DelegateType>handler)I.10.4) [CLS]

  19. Any RemoveOn method for an event whose Name is xxx shall have the signature: void remove_xxx(<DelegateType> handler)I.10.4) [CLS]

  20. 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.