MemberInfo.MemberType MemberInfo.MemberType MemberInfo.MemberType MemberInfo.MemberType Property

정의

파생 클래스에서 재정의될 경우 멤버의 형식(메서드, 생성자, 이벤트 등)을 나타내는 MemberTypes 값을 가져옵니다.When overridden in a derived class, gets a MemberTypes value indicating the type of the member - method, constructor, event, and so on.

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

속성 값

멤버 형식을 나타내는 MemberTypes 값입니다.A MemberTypes value indicating the type of member.

구현

예제

다음 예제에서는 지정된 된 클래스의 형식과 멤버 이름을 표시합니다.The following example displays the member name and type of a specified class.

using namespace System;
using namespace System::Reflection;
int main()
{
   Console::WriteLine( "\nReflection.MemberInfo" );
   
   // Get the Type and MemberInfo.
   Type^ MyType = Type::GetType( "System.Reflection.PropertyInfo" );
   array<MemberInfo^>^Mymemberinfoarray = MyType->GetMembers();
   
   // Get the MemberType method and display the elements.
   Console::Write( "\nThere are {0} members in ", Mymemberinfoarray->GetLength( 0 ) );
   Console::Write( "{0}.", MyType->FullName );
   for ( int counter = 0; counter < Mymemberinfoarray->Length; counter++ )
   {
      Console::Write( "\n{0}. {1} Member type - {2}", counter, Mymemberinfoarray[ counter ]->Name, Mymemberinfoarray[ counter ]->MemberType );

   }
   return 0;
}

using System;
using System.Reflection;
 
class Mymemberinfo
{
    public static int Main()
    {
        Console.WriteLine ("\nReflection.MemberInfo");
       
        // Get the Type and MemberInfo.
        Type MyType = Type.GetType("System.Reflection.PropertyInfo");
        MemberInfo[] Mymemberinfoarray = MyType.GetMembers();
  
        // Get the MemberType method and display the elements.
        Console.Write("\nThere are {0} members in ", Mymemberinfoarray.GetLength(0));
        Console.Write("{0}.", MyType.FullName);
  
        for (int counter = 0; counter < Mymemberinfoarray.Length; counter++)
        {
            Console.Write("\n" + counter + ". " 
                + Mymemberinfoarray[counter].Name
                + " Member type - " +
                Mymemberinfoarray[counter].MemberType.ToString());
        }
        return 0;
    }
}

Imports System.Reflection

Class Mymemberinfo

    Public Shared Function Main() As Integer
        Console.WriteLine(ControlChars.Cr + "Reflection.MemberInfo")

        ' Get the Type and MemberInfo.
        Dim MyType As Type = Type.GetType("System.Reflection.PropertyInfo")
        Dim Mymemberinfoarray As MemberInfo() = MyType.GetMembers()

        ' Get the MemberType method and display the elements.
        Console.Write(ControlChars.Cr + "There are {0} members in ", _
           Mymemberinfoarray.GetLength(0))
        Console.Write("{0}.", MyType.FullName)

        Dim counter As Integer
        For counter = 0 To Mymemberinfoarray.Length - 1
            Console.Write(ControlChars.CrLf + counter.ToString() + ". " _
               + Mymemberinfoarray(counter).Name _
               + " Member type - " _
               + Mymemberinfoarray(counter).MemberType.ToString())
        Next counter
        Return 0
    End Function
End Class

설명

이 속성은 파생된 클래스에서 재정의 되 고 재정의 적절 한 멤버 형식을 반환 합니다.This property is overridden in derived classes, and the override returns the appropriate member type. 따라서 MemberInfo 개체 집합을 검사 하는 경우 (예:에서 GetMembers 반환 된 배열) MemberType 속성을 사용 하 여 지정 된 멤버의 멤버 형식을 확인할 수 있습니다.Therefore, when you examine a set of MemberInfo objects - for example, the array returned by GetMembers - the MemberType property can be used to determine the member type of any given member.

가져오려는 합니다 MemberType 속성을 클래스를 가져옵니다 Type합니다.To get the MemberType property, get the class Type. Type, 가져오기는 MethodInfo 배열입니다.From the Type, get the MethodInfo array. MethodInfo 배열에 MemberTypes합니다.From the MethodInfo array, get the MemberTypes.

적용 대상

추가 정보