PropertyInfo.MemberType 속성

정의

이 멤버가 속성임을 나타내는 MemberTypes 값을 가져옵니다.Gets a MemberTypes value indicating that this member is a property.

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 property.

구현

예제

다음 예제에서는 지정된 된 멤버의 유형을 표시합니다.The following example displays the type of the specified member.

using namespace System;
using namespace System::Reflection;
int main()
{
   Console::WriteLine( "\nReflection.PropertyInfo" );
   
   // Get the type and PropertyInfo.
   Type^ MyType = Type::GetType( "System.Reflection.MemberInfo" );
   PropertyInfo^ Mypropertyinfo = MyType->GetProperty( "Name" );
   
   // Read and display the MemberType property.
   Console::Write( "\nMemberType = {0}", Mypropertyinfo->MemberType );
   return 0;
}

using System;
using System.Reflection;
 
class Mypropertyinfo
{
    public static int Main()
    {
        Console.WriteLine("\nReflection.PropertyInfo");
  
        // Get the type and PropertyInfo.
        Type MyType = Type.GetType("System.Reflection.MemberInfo");
        PropertyInfo Mypropertyinfo = MyType.GetProperty("Name");
  
        // Read and display the MemberType property.
        Console.Write("\nMemberType = " + Mypropertyinfo.MemberType.ToString());
  
        return 0;
    }
}
Imports System.Reflection

Class Mypropertyinfo

    Public Shared Function Main() As Integer
        Console.WriteLine(ControlChars.CrLf & "Reflection.PropertyInfo")

        ' Get the type and PropertyInfo.
        Dim MyType As Type = Type.GetType("System.Reflection.MemberInfo")
        Dim Mypropertyinfo As PropertyInfo = MyType.GetProperty("Name")

        ' Read and display the MemberType property.
        Console.WriteLine("MemberType = " & _
           Mypropertyinfo.MemberType.ToString())

        Return 0
    End Function
End Class

설명

이 속성은 MemberType를 재정의 합니다.This property overrides MemberType. 따라서 MemberInfo 개체 집합 (예: GetMembers에서 반환 된 배열)을 검사할 때 MemberType 속성은 지정 된 멤버가 속성인 경우에만 Property을 반환 합니다.Therefore, when you examine a set of MemberInfo objects - for example, the array returned by GetMembers - the MemberType property returns Property only when a given member is a property.

MemberTypeMemberInfo의 파생 클래스 이며이 클래스의 멤버 형식을 지정 합니다.MemberType is a derived class of MemberInfo and specifies the type of member this is. 멤버 형식은 생성자, 속성, 필드 및 메서드입니다.Member types are constructors, properties, fields, and methods. 이 속성은 PropertyInfo 속성 이므로 반환 된 형식은 속성입니다.Since this is a PropertyInfo property, the returned type is a property.

MemberType 속성을 가져오려면 먼저 클래스 Type가져옵니다.To get the MemberType property, first get the class Type. Type에서 PropertyInfo를 가져옵니다.From the Type, get the PropertyInfo. PropertyInfo에서 MemberType 값을 가져옵니다.From the PropertyInfo, get the MemberType value.

적용 대상