PropertyInfo.MemberType-Eigenschaft
Ruft einen MemberTypes-Wert ab, der angibt, dass dieser Member eine Eigenschaft ist.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Overrides ReadOnly Property MemberType As MemberTypes
'Usage
Dim instance As PropertyInfo
Dim value As MemberTypes
value = instance.MemberType
public override MemberTypes MemberType { get; }
public:
virtual property MemberTypes MemberType {
MemberTypes get () override;
}
/** @property */
public MemberTypes get_MemberType ()
public override function get MemberType () : MemberTypes
Eigenschaftenwert
Ein MemberTypes-Wert, der angibt, dass dieser Member eine Eigenschaft ist.
Hinweise
Diese Eigenschaft überschreibt MemberType. Wenn Sie daher eine Gruppe von MemberInfo-Objekten untersuchen, z. B. das von GetMembers zurückgegebene Array, gibt die MemberType-Eigenschaft nur dann Property zurück, wenn ein bestimmter Member eine Eigenschaft ist.
MemberType ist eine abgeleitete Klasse von MemberInfo und gibt den Typ des Members an. Membertypen sind Konstruktoren, Eigenschaften, Felder und Methoden. Da es sich hierbei um eine PropertyInfo-Eigenschaft handelt, wird als Typ eine Eigenschaft zurückgegeben.
Um die MemberType-Eigenschaft abzurufen, rufen Sie zunächst den Type der Klasse ab. Über Type rufen Sie PropertyInfo ab. Aus PropertyInfo rufen Sie den MemberType-Wert ab.
Beispiel
Im folgenden Beispiel wird der Typ des angegebenen Members angezeigt.
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
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;
}
}
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;
}
import System.*;
import System.Reflection.*;
class MyPropertyInfo
{
public static void main(String[] args)
{
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.get_MemberType().ToString()));
} //main
} //MyPropertyInfo
import System;
import System.Reflection;
class Mypropertyinfo
{
public static function Main() : void
{
Console.WriteLine("\nReflection.PropertyInfo");
//Get the type and PropertyInfo
var MyType : Type = Type.GetType("System.Reflection.MemberInfo");
var Mypropertyinfo : PropertyInfo = MyType.GetProperty("Name");
//Read and display the MemberType property
Console.Write("\nMemberType = " + Mypropertyinfo.MemberType.ToString());
}
}
Mypropertyinfo.Main();
/*
Produces the following output
Reflection.PropertyInfo
MemberType = Property
*/
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
PropertyInfo-Klasse
PropertyInfo-Member
System.Reflection-Namespace