A member lookup is the process whereby the meaning of a name in the context of a type is determined. A member lookup may occur as part of evaluating a simple-name (§7.5.2) or a member-access (§7.5.4) in an expression.
A member lookup of a name N
in a type T
is processed as follows:
N
declared in T
and the base types (§7.3.1) of T
is constructed. Declarations that include an override
modifier are excluded from the set. If no members named N
exist and are accessible, then the lookup produces no match, and the following steps are not evaluated.S.M
in the set, where S
in the type in which the member M
is declared, the following rules are applied:
M
is a constant, field, property, event, type, or enumeration member, then all members declared in a base type of S
are removed from the set.M
is a method, then all non-method members declared in a base type of S
are removed from the set, and all methods with the same signature as M
declared in a base type of S
are removed from the set.For member lookups in types other than interfaces, and member lookups in interfaces that are strictly single-inheritance (each interface in the inheritance chain has exactly zero or one direct base interface), the effect of the lookup rules is simply that derived members hide base members with the same name or signature. Such single-inheritance lookups are never ambiguous. The ambiguities that can possibly arise from member lookups in multiple-inheritance interfaces are described in §13.2.5.