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.MemberType覆寫。This 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.TypeInfo一律會傳回。If the current Type represents a type parameter in the definition of a generic type or generic method, this property always returns MemberTypes.TypeInfo.

適用於

另請參閱