Jon Jagger
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 20 Interfacesprevious at this levelnext at this level 20.2 Interface members Paragraph 11 The members of an interface are the members inherited from the base interfaces and the members declared by the interface itself. interface-member-declarations : interface-member-declaration interface-member-declarations interface-member-declaration interface-member-declaration : interface-method-declaration interface-property-declaration interface-event-declaration interface-indexer-declaration Paragraph 21 An interface declaration may declare zero or more members. 2 The members of an interface must be methods, properties, events, or indexers. 3 An interface cannot contain constants, fields, operators, instance constructors, destructors, or types, nor can an interface contain static members of any kind. Paragraph 31 All interface members implicitly have public access. 2 It is a compile-time error for interface member declarations to include any modifiers. 3 In particular, interface members cannot be declared with the modifiers abstract, public, protected, internal, private, virtual, override, or static. [Example: The example
public delegate void StringListEvent(IStringList sender);  
public interface IStringList  
   void Add(string s);  
   int Count { get; }  
   event StringListEvent Changed;  
   string this[int index] { get; set; }  
declares an interface that contains one each of the possible kinds of members: A method, a property, an event, and an indexer. end example]
Paragraph 41 An interface-declaration creates a new declaration space (§10.3), and the interface-member-declarations immediately contained by the interface-declaration introduce new members into this declaration space. 2 The following rules apply to interface-member-declarations: Paragraph 51 The inherited members of an interface are specifically not part of the declaration space of the interface. 2 Thus, an interface is allowed to declare a member with the same name or signature as an inherited member. 3 When this occurs, the derived interface member is said to hide the base interface member. 4 Hiding an inherited member is not considered an error, but it does cause the compiler to issue a warning. 5 To suppress the warning, the declaration of the derived interface member must include a new modifier to indicate that the derived member is intended to hide the base member. 6 This topic is discussed further in § Paragraph 61 If a new modifier is included in a declaration that doesn't hide an inherited member, a warning is issued to that effect. 2 This warning is suppressed by removing the new modifier.
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS