MemberTypes 열거형

정의

정의된 멤버의 각 형식을 MemberInfo의 파생 클래스로 표시합니다.Marks each type of member that is defined as a derived class of MemberInfo.

이 열거형에는 멤버 값의 비트 조합을 허용하는 FlagsAttribute 특성이 있습니다.

public enum class MemberTypes
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum MemberTypes
type MemberTypes = 
Public Enum MemberTypes
상속
MemberTypes
특성

필드

All 191

모든 멤버 형식을 지정합니다.Specifies all member types.

Constructor 1

멤버가 생성자임을 지정합니다.Specifies that the member is a constructor.

Custom 64

멤버가 사용자 지정 멤버 형식임을 지정합니다.Specifies that the member is a custom member type.

Event 2

멤버가 이벤트임을 지정합니다.Specifies that the member is an event.

Field 4

멤버가 필드임을 지정합니다.Specifies that the member is a field.

Method 8

멤버가 메서드임을 지정합니다.Specifies that the member is a method.

NestedType 128

멤버가 중첩된 형식임을 지정합니다.Specifies that the member is a nested type.

Property 16

멤버가 속성임을 지정합니다.Specifies that the member is a property.

TypeInfo 32

멤버가 형식임을 지정합니다.Specifies that the member is a type.

예제

다음 예제에서는 멤버의 이름을 표시 합니다 ReflectionTypeLoadException 클래스 및 해당 관련된 멤버 형식입니다.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

설명

이 열거형 값이 같은 속성으로 반환 됩니다.These enumeration values are returned by the following properties:

가져올는 MemberTypes 유형에 대 한 값:To obtain the MemberTypes value for a type:

  1. 가져오기는 Type 형식임을 나타내는 개체입니다.Get a Type object that represents that type.

  2. 값을 검색 합니다 Type.MemberType 속성입니다.Retrieve the value of the Type.MemberType property.

가져오려는 MemberTypes 형식의 멤버에 대 한 값입니다.:To get the MemberTypes values for the members of a type.:

  1. 가져오기는 Type 형식임을 나타내는 개체입니다.Get a Type object that represents that type.

  2. 검색을 MemberInfo 를 호출 하 여 해당 형식의 멤버를 나타내는 배열은 Type.GetMembers 메서드.Retrieve the MemberInfo array that represents the members of that type by calling the Type.GetMembers method.

  3. From의 값을 검색 합니다 MemberInfo.MemberType 배열의 각 멤버에 대 한 속성입니다.Retrieve the value of the From the MemberInfo.MemberType property for each member in the array. A switch C#의 문은 또는 Select Case Visual Basic에서 문이 멤버 형식을 처리 하려면 일반적으로 사용 됩니다.A switch statement in C# or Select Case statement in Visual Basic is typically used to process member types.

MemberTypes corhdr.h 파일에 정의 된 대로 CorTypeAttr와 일치 합니다.MemberTypes matches CorTypeAttr as defined in the corhdr.h file.

적용 대상