PropertyInfo.MemberType Propiedad

Definición

Obtiene un valor MemberTypes que indica que este miembro es una propiedad.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

Valor de propiedad

Valor MemberTypes que indica que este miembro es una propiedad.A MemberTypes value indicating that this member is a property.

Implementaciones

Ejemplos

En el ejemplo siguiente se muestra el tipo del miembro especificado.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

Comentarios

Esta propiedad invalida MemberType.This property overrides MemberType. Por lo tanto, al examinar un conjunto de objetos de MemberInfo, por ejemplo, la matriz devuelta por GetMembers-la propiedad MemberType devuelve Property solo cuando un miembro determinado es una propiedad.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 es una clase derivada de MemberInfo y especifica el tipo de miembro.MemberType is a derived class of MemberInfo and specifies the type of member this is. Los tipos de miembro son constructores, propiedades, campos y métodos.Member types are constructors, properties, fields, and methods. Dado que se trata de una propiedad PropertyInfo, el tipo devuelto es una propiedad.Since this is a PropertyInfo property, the returned type is a property.

Para obtener la propiedad MemberType, obtenga primero la clase Type.To get the MemberType property, first get the class Type. En el Type, obtenga el PropertyInfo.From the Type, get the PropertyInfo. En el PropertyInfo, obtenga el valor de MemberType.From the PropertyInfo, get the MemberType value.

Se aplica a