A simple name consists of a single identifier.
simple-name:
identifier
A simple name is calculated and classified as follows:
If a simple name appears within a block and if the block's local declaration space or enclosing blocks' local declaration space contains a local variable or parameter with the given name, then the simple name refers to that local variable or parameter and is classified as a variable.
Otherwise, a name is searched for in the enclosing type T (class, structure or enumeration) by member lookup:
If T is a class or structure type and the member lookup identifies one or more methods, the result is the given method group.
If T is a class or structure type, if the member lookup identifies an instance member, and if the reference occurs within the body of an instance constructor, an instance method, or an instance accessor, the result is the same as a member access of the form Self.E, where E is a simple name.
Otherwise, the result is the same as a member access of the form T.E, where E is the simple name. In this case, a compile error occurs if E refers to an instance member.
Otherwise, the name is searched for starting with the namespace in which the simple name occurs, continuing with each enclosing namespace and ending with the global namespace:
If the namespace contains a namespace member with the given name, then the simple name refers to that member and, depending on the member, is classified as a namespace or a type.
Otherwise, if the namespace declaration imports other namespaces using the Imports directive and the imported namespaces contain exactly one type with the given name, then the simple name refers to this type.
Otherwise, if the namespace declaration imports other namespaces using the Imports directive and the imported namespaces contain more than one type with the given name, then the simple name is ambiguous and a compile error occurs.
Otherwise, the simple name is undetermined and a compile error occurs.
See also: