PropertyInfo.MemberType Proprietà

Definizione

Ottiene un valore MemberTypes che indica che questo membro è una proprietà.

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

Valore della proprietà

MemberTypes

Valore MemberTypes che indica che questo membro è una proprietà.

Implementazioni

Esempio

Nell'esempio seguente viene visualizzato il tipo del membro specificato.

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

Commenti

Questa proprietà esegue l'override di MemberType . Pertanto, quando si esamina un set di oggetti, ad esempio la matrice restituita da , la proprietà restituisce solo quando un MemberInfo determinato membro è una GetMembers MemberType Property proprietà.

MemberType è una classe derivata di MemberInfo e specifica il tipo di membro. I tipi di membro sono costruttori, proprietà, campi e metodi. Poiché si tratta di PropertyInfo una proprietà, il tipo restituito è una proprietà.

Per ottenere la MemberType proprietà , ottenere prima la classe Type . Da Type ottenere PropertyInfo l'oggetto . Da PropertyInfo ottenere il MemberType valore .

Si applica a