PropertyInfo.MemberType PropertyInfo.MemberType PropertyInfo.MemberType PropertyInfo.MemberType Property

정의

이 멤버가 속성임을 나타내는 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
Imports System.Reflection
Imports Microsoft.VisualBasic

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.

MemberType 파생 클래스인 MemberInfo 이 멤버의 형식을 지정 합니다.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.

적용 대상