MemberTypes MemberTypes MemberTypes MemberTypes Enum

Definition

Markiert jeden Typ des Members, der als abgeleitete Klasse von MemberInfo definiert ist.Marks each type of member that is defined as a derived class of MemberInfo.

Diese Enumeration weist ein FlagsAttribute-Attribut auf, die eine bitweise Kombination der Memberwerte zulässt.

public enum class MemberTypes
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum MemberTypes
type MemberTypes = 
Public Enum MemberTypes
Vererbung
Attribute

Felder

All All All All 191

Gibt alle Membertypen an.Specifies all member types.

Constructor Constructor Constructor Constructor 1

Gibt an, dass der Member ein Konstruktor ist.Specifies that the member is a constructor

Custom Custom Custom Custom 64

Gibt an, dass der Member ein benutzerdefinierter Membertyp ist.Specifies that the member is a custom member type.

Event Event Event Event 2

Gibt an, dass der Member ein Ereignis ist.Specifies that the member is an event.

Field Field Field Field 4

Gibt an, dass der Member ein Feld ist.Specifies that the member is a field.

Method Method Method Method 8

Gibt an, dass der Member eine Methode ist.Specifies that the member is a method.

NestedType NestedType NestedType NestedType 128

Gibt an, dass der Member ein geschachtelter Typ ist.Specifies that the member is a nested type.

Property Property Property Property 16

Gibt an, dass der Member eine Eigenschaft ist.Specifies that the member is a property.

TypeInfo TypeInfo TypeInfo TypeInfo 32

Gibt an, dass der Member ein Typ ist.Specifies that the member is a type.

Beispiele

Das folgende Beispiel zeigt die Namen der Elemente der ReflectionTypeLoadException -Klasse und ihre zugeordneten Member-Typen.The following example displays the names of the members of the ReflectionTypeLoadException class and their associated member types.

using namespace System;
using namespace System::Reflection;
 
void main() 
{
    // Get the type of a chosen class.
    Type^ t = ReflectionTypeLoadException::typeid;

    // Get the MemberInfo array.
    array<MemberInfo^>^ members = t->GetMembers();

    // Get and display the name and the MemberType for each member.
    Console::WriteLine("Members of {0}", t->Name);
    for each (MemberInfo^ member in members) { 
        MemberTypes memberType = member->MemberType; 
        Console::WriteLine("   {0}: {1}", member->Name, memberType);
    }
}
// The example displays the following output:
//       Members of ReflectionTypeLoadException
//          get_Types: Method
//          get_LoaderExceptions: Method
//          GetObjectData: Method
//          get_Message: Method
//          get_Data: Method
//          GetBaseException: Method
//          get_InnerException: Method
//          get_TargetSite: Method
//          get_StackTrace: Method
//          get_HelpLink: Method
//          set_HelpLink: Method
//          get_Source: Method
//          set_Source: Method
//          ToString: Method
//          get_HResult: Method
//          GetType: Method
//          Equals: Method
//          GetHashCode: Method
//          GetType: Method
//          .ctor: Constructor
//          .ctor: Constructor
//          Types: Property
//          LoaderExceptions: Property
//          Message: Property
//          Data: Property
//          InnerException: Property
//          TargetSite: Property
//          StackTrace: Property
//          HelpLink: Property
//          Source: Property
//          HResult: Property
using System;
using System.Reflection;
 
class Example
{
    public static void Main() 
    {
        // Get the type of a chosen class.
        Type t = typeof(ReflectionTypeLoadException);
 
        // Get the MemberInfo array.
        MemberInfo[] members = t.GetMembers();
 
        // Get and display the name and the MemberType for each member.
        Console.WriteLine("Members of {0}", t.Name);
        foreach (var member in members) { 
            MemberTypes memberType = member.MemberType; 
            Console.WriteLine("   {0}: {1}", member.Name, memberType);
        }
    }
}
// The example displays the following output:
//       Members of ReflectionTypeLoadException
//          get_Types: Method
//          get_LoaderExceptions: Method
//          GetObjectData: Method
//          get_Message: Method
//          get_Data: Method
//          GetBaseException: Method
//          get_InnerException: Method
//          get_TargetSite: Method
//          get_StackTrace: Method
//          get_HelpLink: Method
//          set_HelpLink: Method
//          get_Source: Method
//          set_Source: Method
//          ToString: Method
//          get_HResult: Method
//          GetType: Method
//          Equals: Method
//          GetHashCode: Method
//          GetType: Method
//          .ctor: Constructor
//          .ctor: Constructor
//          Types: Property
//          LoaderExceptions: Property
//          Message: Property
//          Data: Property
//          InnerException: Property
//          TargetSite: Property
//          StackTrace: Property
//          HelpLink: Property
//          Source: Property
//          HResult: Property
Imports System.Reflection

Module Example
    Public Sub Main()
        ' Get the type of a particular class.
        Dim t As Type = GetType(ReflectionTypeLoadException)

        ' Get the MemberInfo array.
        Dim members As MemberInfo() = t.GetMembers()

        ' Get and display the name and the MemberType for each member.
        Console.WriteLine("Members of {0}", t.Name)
        For Each member In members
            Dim memberType As MemberTypes = member.MemberType
            Console.WriteLine("   {0}: {1}", member.Name, memberType)
        Next
    End Sub
End Module
' The example displays the following output:
'       Members of ReflectionTypeLoadException
'          get_Types: Method
'          get_LoaderExceptions: Method
'          GetObjectData: Method
'          get_Message: Method
'          get_Data: Method
'          GetBaseException: Method
'          get_InnerException: Method
'          get_TargetSite: Method
'          get_StackTrace: Method
'          get_HelpLink: Method
'          set_HelpLink: Method
'          get_Source: Method
'          set_Source: Method
'          ToString: Method
'          get_HResult: Method
'          GetType: Method
'          Equals: Method
'          GetHashCode: Method
'          GetType: Method
'          .ctor: Constructor
'          .ctor: Constructor
'          Types: Property
'          LoaderExceptions: Property
'          Message: Property
'          Data: Property
'          InnerException: Property
'          TargetSite: Property
'          StackTrace: Property
'          HelpLink: Property
'          Source: Property
'          HResult: Property

Hinweise

Diese Enumerationswerte werden durch die folgenden Eigenschaften zurückgegeben:These enumeration values are returned by the following properties:

Zum Abrufen der MemberTypes Wert für einen Typ:To obtain the MemberTypes value for a type:

  1. Abrufen einer Type -Objekt, das diesen Typ darstellt.Get a Type object that represents that type.

  2. Abrufen des Werts der Type.MemberType Eigenschaft.Retrieve the value of the Type.MemberType property.

Zum Abrufen der MemberTypes Werte für den Member eines Typs.:To get the MemberTypes values for the members of a type.:

  1. Abrufen einer Type -Objekt, das diesen Typ darstellt.Get a Type object that represents that type.

  2. Abrufen der MemberInfo Array, die Member dieses Typs, durch den Aufruf darstellt, der Type.GetMembers Methode.Retrieve the MemberInfo array that represents the members of that type by calling the Type.GetMembers method.

  3. Abrufen des Werts von der MemberInfo.MemberType -Eigenschaft für jedes Element im Array.Retrieve the value of the From the MemberInfo.MemberType property for each member in the array. Ein switch -Anweisung in C# oder Select Case -Anweisung in Visual Basic wird normalerweise verwendet, um Elemente zu verarbeiten.A switch statement in C# or Select Case statement in Visual Basic is typically used to process member types.

MemberTypes CorTypeAttr entspricht, wie in der Datei "corhdr.h" definiert.MemberTypes matches CorTypeAttr as defined in the corhdr.h file.

Gilt für: