Type.MemberType Type.MemberType Type.MemberType Type.MemberType Property

定义

获取一个指示此成员是类型还是嵌套类型的 MemberTypes 值。Gets a MemberTypes value indicating that this member is a type or a nested type.

public:
 virtual property System::Reflection::MemberTypes MemberType { System::Reflection::MemberTypes get(); };
public override System.Reflection.MemberTypes MemberType { get; }
member this.MemberType : System.Reflection.MemberTypes
Public Overrides ReadOnly Property MemberType As MemberTypes

属性值

一个 MemberTypes 值,指示此成员是类型还是嵌套类型。A MemberTypes value indicating that this member is a type or a nested type.

实现

示例

下面的代码示例演示MemberType字段的参数作为GetMember方法:The following code example shows the MemberType field as a parameter to the GetMember method:

array<MemberInfo^>^ others = t->GetMember( mi->Name, mi->MemberType,
   (BindingFlags)(BindingFlags::Public | BindingFlags::Static |
      BindingFlags::NonPublic | BindingFlags::Instance) );
MemberInfo[] others = t.GetMember(mi.Name, mi.MemberType, BindingFlags.Public |
BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance);
Dim others As MemberInfo() = t.GetMember(mi.Name, mi.MemberType, _
BindingFlags.Public Or BindingFlags.Static Or BindingFlags.NonPublic _
Or BindingFlags.Instance)

注解

此属性将替代MemberInfo.MemberTypeThis property overrides MemberInfo.MemberType. 因此,检查一系列MemberInfo对象,例如,返回的数组GetMembers-MemberType属性返回MemberTypes.NestedType在给定的成员是嵌套的类型。Therefore, when you examine a set of MemberInfo objects - for example, the array returned by GetMembers - the MemberType property returns MemberTypes.NestedType when a given member is a nested type.

如果当前Type表示构造泛型类型,此属性适用于从其构造类型的泛型类型定义。If the current Type represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. 例如,如果当前Type表示MyGenericType<int>(MyGenericType(Of Integer)在 Visual Basic 中),此属性的值由MyGenericType<T>For example, if the current Type represents MyGenericType<int> (MyGenericType(Of Integer) in Visual Basic), the value of this property is determined by MyGenericType<T>.

如果当前Type表示泛型类型或泛型方法定义中的类型参数,此属性始终返回MemberTypes.TypeInfoIf the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns MemberTypes.TypeInfo.

适用于

另请参阅