An interface member is sometimes referred to by its fully qualified name.
The fully qualified name of an
interface member consists of the name of the interface in which the member
is declared, followed by a dot,
followed by the name of the member. The fully qualified name of a member
references the interface in which the
member is declared. [Example: For example, given the declarations
C# LANGUAGE SPECIFICATION
284
interface IControl
{
void Paint();
}
interface ITextBox: IControl
{
void SetText(string text);
}
the fully qualified name of Paint is IControl.Paint and the fully qualified
name of SetText is
ITextBox.SetText. In the example above, it is not possible to refer to
Paint as ITextBox.Paint. end
example]
When an interface is part of a namespace, the fully qualified name of an
interface member includes the
namespace name. [Example: For example
namespace System
{
public interface ICloneable
{
object Clone();
}
}
Here, the fully qualified name of the Clone method is
System.ICloneable.Clone. end example]
The fully qualified name of an
interface member consists of the name of the interface in which the member
is declared, followed by a dot,
followed by the name of the member. The fully qualified name of a member
references the interface in which the
member is declared. [Example: For example, given the declarations
C# LANGUAGE SPECIFICATION
284
interface IControl
{
void Paint();
}
interface ITextBox: IControl
{
void SetText(string text);
}
the fully qualified name of Paint is IControl.Paint and the fully qualified
name of SetText is
ITextBox.SetText. In the example above, it is not possible to refer to
Paint as ITextBox.Paint. end
example]
When an interface is part of a namespace, the fully qualified name of an
interface member includes the
namespace name. [Example: For example
namespace System
{
public interface ICloneable
{
object Clone();
}
}
Here, the fully qualified name of the Clone method is
System.ICloneable.Clone. end example]
本文详细解释了在编程中如何使用完全限定名来引用接口成员,包括成员所在接口的名字及成员名称,并通过C#示例展示了当接口位于命名空间内时,如何包含命名空间名称来形成完全限定名。
5911

被折叠的 条评论
为什么被折叠?



