PropertyBuilder Classe

Définition

Définit les propriétés d'un type.

public ref class PropertyBuilder sealed : System::Reflection::PropertyInfo
public ref class PropertyBuilder abstract : System::Reflection::PropertyInfo
public ref class PropertyBuilder sealed : System::Reflection::PropertyInfo, System::Runtime::InteropServices::_PropertyBuilder
public sealed class PropertyBuilder : System.Reflection.PropertyInfo
public abstract class PropertyBuilder : System.Reflection.PropertyInfo
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
public sealed class PropertyBuilder : System.Reflection.PropertyInfo, System.Runtime.InteropServices._PropertyBuilder
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class PropertyBuilder : System.Reflection.PropertyInfo, System.Runtime.InteropServices._PropertyBuilder
type PropertyBuilder = class
    inherit PropertyInfo
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
type PropertyBuilder = class
    inherit PropertyInfo
    interface _PropertyBuilder
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PropertyBuilder = class
    inherit PropertyInfo
    interface _PropertyBuilder
Public NotInheritable Class PropertyBuilder
Inherits PropertyInfo
Public MustInherit Class PropertyBuilder
Inherits PropertyInfo
Public NotInheritable Class PropertyBuilder
Inherits PropertyInfo
Implements _PropertyBuilder
Héritage
PropertyBuilder
Attributs
Implémente

Exemples

L’exemple de code suivant montre comment implémenter des propriétés dans un type dynamique à l’aide d’un PropertyBuilder obtenu via TypeBuilder.DefineProperty pour créer l’infrastructure de propriétés et un associé MethodBuilder pour implémenter la logique IL dans la propriété.

using namespace System;
using namespace System::Threading;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
Type^ BuildDynamicTypeWithProperties()
{
   AppDomain^ myDomain = Thread::GetDomain();
   AssemblyName^ myAsmName = gcnew AssemblyName;
   myAsmName->Name = "MyDynamicAssembly";
   
   // To generate a persistable assembly, specify AssemblyBuilderAccess::RunAndSave.
   AssemblyBuilder^ myAsmBuilder = 
       myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave );
   
   // Generate a persistable single-module assembly.
   ModuleBuilder^ myModBuilder = 
       myAsmBuilder->DefineDynamicModule( myAsmName->Name, myAsmName->Name + ".dll" );
   TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public );

   // Define a private field to hold the property value.
   FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private );
   
   // The last argument of DefineProperty is an empty array of Type
   // objects, because the property has no parameters. (Alternatively,
   // you can specify a null value.)
   PropertyBuilder^ custNamePropBldr = 
       myTypeBuilder->DefineProperty( "CustomerName", PropertyAttributes::HasDefault, String::typeid, gcnew array<Type^>(0) );
   
   // The property set and property get methods require a special
   // set of attributes.
   MethodAttributes getSetAttr = 
       MethodAttributes::Public | MethodAttributes::SpecialName |
           MethodAttributes::HideBySig;

   // Define the "get" accessor method for CustomerName.
   MethodBuilder^ custNameGetPropMthdBldr = 
       myTypeBuilder->DefineMethod( "get_CustomerName", 
                                    getSetAttr,
                                    String::typeid, 
                                    Type::EmptyTypes );

   ILGenerator^ custNameGetIL = custNameGetPropMthdBldr->GetILGenerator();
   custNameGetIL->Emit( OpCodes::Ldarg_0 );
   custNameGetIL->Emit( OpCodes::Ldfld, customerNameBldr );
   custNameGetIL->Emit( OpCodes::Ret );
   
   // Define the "set" accessor method for CustomerName.
   array<Type^>^temp2 = {String::typeid};
   MethodBuilder^ custNameSetPropMthdBldr = 
       myTypeBuilder->DefineMethod( "set_CustomerName", 
                                    getSetAttr,
                                    nullptr, 
                                    temp2 );

   ILGenerator^ custNameSetIL = custNameSetPropMthdBldr->GetILGenerator();
   custNameSetIL->Emit( OpCodes::Ldarg_0 );
   custNameSetIL->Emit( OpCodes::Ldarg_1 );
   custNameSetIL->Emit( OpCodes::Stfld, customerNameBldr );
   custNameSetIL->Emit( OpCodes::Ret );
   
   // Last, we must map the two methods created above to our PropertyBuilder to
   // their corresponding behaviors, "get" and "set" respectively.
   custNamePropBldr->SetGetMethod( custNameGetPropMthdBldr );
   custNamePropBldr->SetSetMethod( custNameSetPropMthdBldr );

   Type^ retval = myTypeBuilder->CreateType();

   // Save the assembly so it can be examined with Ildasm.exe,
   // or referenced by a test program.
   myAsmBuilder->Save(myAsmName->Name + ".dll");
   return retval;
}

int main()
{
   Type^ custDataType = BuildDynamicTypeWithProperties();
   array<PropertyInfo^>^custDataPropInfo = custDataType->GetProperties();
   System::Collections::IEnumerator^ myEnum = custDataPropInfo->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      PropertyInfo^ pInfo = safe_cast<PropertyInfo^>(myEnum->Current);
      Console::WriteLine( "Property '{0}' created!", pInfo );
   }

   Console::WriteLine( "---" );
   
   // Note that when invoking a property, you need to use the proper BindingFlags -
   // BindingFlags::SetProperty when you invoke the "set" behavior, and
   // BindingFlags::GetProperty when you invoke the "get" behavior. Also note that
   // we invoke them based on the name we gave the property, as expected, and not
   // the name of the methods we bound to the specific property behaviors.
   Object^ custData = Activator::CreateInstance( custDataType );
   array<Object^>^temp3 = {"Joe User"};
   custDataType->InvokeMember( "CustomerName", BindingFlags::SetProperty, nullptr, custData, temp3 );
   Console::WriteLine( "The customerName field of instance custData has been set to '{0}'.", custDataType->InvokeMember( "CustomerName", BindingFlags::GetProperty, nullptr, custData, gcnew array<Object^>(0) ) );
}

// --- O U T P U T ---
// The output should be as follows:
// -------------------
// Property 'System.String CustomerName' created!
// ---
// The customerName field of instance custData has been set to 'Joe User'.
// -------------------
using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;

class PropertyBuilderDemo
{
   public static Type BuildDynamicTypeWithProperties()
   {
        AppDomain myDomain = Thread.GetDomain();
        AssemblyName myAsmName = new AssemblyName();
        myAsmName.Name = "MyDynamicAssembly";

        // To generate a persistable assembly, specify AssemblyBuilderAccess.RunAndSave.
        AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly(myAsmName,
                                                        AssemblyBuilderAccess.RunAndSave);
        // Generate a persistable single-module assembly.
        ModuleBuilder myModBuilder =
            myAsmBuilder.DefineDynamicModule(myAsmName.Name, myAsmName.Name + ".dll");

        TypeBuilder myTypeBuilder = myModBuilder.DefineType("CustomerData",
                                                        TypeAttributes.Public);

        FieldBuilder customerNameBldr = myTypeBuilder.DefineField("customerName",
                                                        typeof(string),
                                                        FieldAttributes.Private);

        // The last argument of DefineProperty is null, because the
        // property has no parameters. (If you don't specify null, you must
        // specify an array of Type objects. For a parameterless property,
        // use an array with no elements: new Type[] {})
        PropertyBuilder custNamePropBldr = myTypeBuilder.DefineProperty("CustomerName",
                                                         PropertyAttributes.HasDefault,
                                                         typeof(string),
                                                         null);

        // The property set and property get methods require a special
        // set of attributes.
        MethodAttributes getSetAttr =
            MethodAttributes.Public | MethodAttributes.SpecialName |
                MethodAttributes.HideBySig;

        // Define the "get" accessor method for CustomerName.
        MethodBuilder custNameGetPropMthdBldr =
            myTypeBuilder.DefineMethod("get_CustomerName",
                                       getSetAttr,
                                       typeof(string),
                                       Type.EmptyTypes);

        ILGenerator custNameGetIL = custNameGetPropMthdBldr.GetILGenerator();

        custNameGetIL.Emit(OpCodes.Ldarg_0);
        custNameGetIL.Emit(OpCodes.Ldfld, customerNameBldr);
        custNameGetIL.Emit(OpCodes.Ret);

        // Define the "set" accessor method for CustomerName.
        MethodBuilder custNameSetPropMthdBldr =
            myTypeBuilder.DefineMethod("set_CustomerName",
                                       getSetAttr,
                                       null,
                                       new Type[] { typeof(string) });

        ILGenerator custNameSetIL = custNameSetPropMthdBldr.GetILGenerator();

        custNameSetIL.Emit(OpCodes.Ldarg_0);
        custNameSetIL.Emit(OpCodes.Ldarg_1);
        custNameSetIL.Emit(OpCodes.Stfld, customerNameBldr);
        custNameSetIL.Emit(OpCodes.Ret);

        // Last, we must map the two methods created above to our PropertyBuilder to
        // their corresponding behaviors, "get" and "set" respectively.
        custNamePropBldr.SetGetMethod(custNameGetPropMthdBldr);
        custNamePropBldr.SetSetMethod(custNameSetPropMthdBldr);

        Type retval = myTypeBuilder.CreateType();

        // Save the assembly so it can be examined with Ildasm.exe,
        // or referenced by a test program.
        myAsmBuilder.Save(myAsmName.Name + ".dll");
        return retval;
   }

   public static void Main()
   {
        Type custDataType = BuildDynamicTypeWithProperties();

        PropertyInfo[] custDataPropInfo = custDataType.GetProperties();
        foreach (PropertyInfo pInfo in custDataPropInfo) {
           Console.WriteLine("Property '{0}' created!", pInfo.ToString());
        }

        Console.WriteLine("---");
        // Note that when invoking a property, you need to use the proper BindingFlags -
        // BindingFlags.SetProperty when you invoke the "set" behavior, and
        // BindingFlags.GetProperty when you invoke the "get" behavior. Also note that
        // we invoke them based on the name we gave the property, as expected, and not
        // the name of the methods we bound to the specific property behaviors.

        object custData = Activator.CreateInstance(custDataType);
        custDataType.InvokeMember("CustomerName", BindingFlags.SetProperty,
                                      null, custData, new object[]{ "Joe User" });

        Console.WriteLine("The customerName field of instance custData has been set to '{0}'.",
                           custDataType.InvokeMember("CustomerName", BindingFlags.GetProperty,
                                                      null, custData, new object[]{ }));
   }
}

// --- O U T P U T ---
// The output should be as follows:
// -------------------
// Property 'System.String CustomerName' created!
// ---
// The customerName field of instance custData has been set to 'Joe User'.
// -------------------
Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit

Class PropertyBuilderDemo
   
   Public Shared Function BuildDynamicTypeWithProperties() As Type
      Dim myDomain As AppDomain = Thread.GetDomain()
      Dim myAsmName As New AssemblyName()
      myAsmName.Name = "MyDynamicAssembly"
      
      ' To generate a persistable assembly, specify AssemblyBuilderAccess.RunAndSave.
      Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly(myAsmName, _
                                                        AssemblyBuilderAccess.RunAndSave)
      
      ' Generate a persistable, single-module assembly.
      Dim myModBuilder As ModuleBuilder = _
          myAsmBuilder.DefineDynamicModule(myAsmName.Name, myAsmName.Name & ".dll")
      
      Dim myTypeBuilder As TypeBuilder = myModBuilder.DefineType("CustomerData", TypeAttributes.Public)
      
      ' Define a private field to hold the property value.
      Dim customerNameBldr As FieldBuilder = myTypeBuilder.DefineField("customerName", _
                                             GetType(String), FieldAttributes.Private)
      
      ' The last argument of DefineProperty is Nothing, because the
      ' property has no parameters. (If you don't specify Nothing, you must
      ' specify an array of Type objects. For a parameterless property,
      ' use an array with no elements: New Type() {})
      Dim custNamePropBldr As PropertyBuilder = _
          myTypeBuilder.DefineProperty("CustomerName", _
                                       PropertyAttributes.HasDefault, _
                                       GetType(String), _
                                       Nothing)
      
      ' The property set and property get methods require a special
      ' set of attributes.
      Dim getSetAttr As MethodAttributes = _
          MethodAttributes.Public Or MethodAttributes.SpecialName _
              Or MethodAttributes.HideBySig

      ' Define the "get" accessor method for CustomerName.
      Dim custNameGetPropMthdBldr As MethodBuilder = _
          myTypeBuilder.DefineMethod("GetCustomerName", _
                                     getSetAttr, _
                                     GetType(String), _
                                     Type.EmptyTypes)
      
      Dim custNameGetIL As ILGenerator = custNameGetPropMthdBldr.GetILGenerator()
      
      custNameGetIL.Emit(OpCodes.Ldarg_0)
      custNameGetIL.Emit(OpCodes.Ldfld, customerNameBldr)
      custNameGetIL.Emit(OpCodes.Ret)
      
      ' Define the "set" accessor method for CustomerName.
      Dim custNameSetPropMthdBldr As MethodBuilder = _
          myTypeBuilder.DefineMethod("get_CustomerName", _
                                     getSetAttr, _
                                     Nothing, _
                                     New Type() {GetType(String)})
      
      Dim custNameSetIL As ILGenerator = custNameSetPropMthdBldr.GetILGenerator()
      
      custNameSetIL.Emit(OpCodes.Ldarg_0)
      custNameSetIL.Emit(OpCodes.Ldarg_1)
      custNameSetIL.Emit(OpCodes.Stfld, customerNameBldr)
      custNameSetIL.Emit(OpCodes.Ret)
      
      ' Last, we must map the two methods created above to our PropertyBuilder to 
      ' their corresponding behaviors, "get" and "set" respectively. 
      custNamePropBldr.SetGetMethod(custNameGetPropMthdBldr)
      custNamePropBldr.SetSetMethod(custNameSetPropMthdBldr)
            
      Dim retval As Type = myTypeBuilder.CreateType()

      ' Save the assembly so it can be examined with Ildasm.exe,
      ' or referenced by a test program.
      myAsmBuilder.Save(myAsmName.Name & ".dll")
      return retval
   End Function 'BuildDynamicTypeWithProperties
    
   
   Public Shared Sub Main()
      Dim custDataType As Type = BuildDynamicTypeWithProperties()
      
      Dim custDataPropInfo As PropertyInfo() = custDataType.GetProperties()
      Dim pInfo As PropertyInfo
      For Each pInfo In  custDataPropInfo
         Console.WriteLine("Property '{0}' created!", pInfo.ToString())
      Next pInfo
      
      Console.WriteLine("---")
      ' Note that when invoking a property, you need to use the proper BindingFlags -
      ' BindingFlags.SetProperty when you invoke the "set" behavior, and 
      ' BindingFlags.GetProperty when you invoke the "get" behavior. Also note that
      ' we invoke them based on the name we gave the property, as expected, and not
      ' the name of the methods we bound to the specific property behaviors.
      Dim custData As Object = Activator.CreateInstance(custDataType)
      custDataType.InvokeMember("CustomerName", BindingFlags.SetProperty, Nothing, _
                                custData, New Object() {"Joe User"})
      
      Console.WriteLine("The customerName field of instance custData has been set to '{0}'.", _
                        custDataType.InvokeMember("CustomerName", BindingFlags.GetProperty, _
                        Nothing, custData, New Object() {}))
   End Sub
End Class


' --- O U T P U T ---
' The output should be as follows:
' -------------------
' Property 'System.String CustomerName' created!
' ---
' The customerName field of instance custData has been set to 'Joe User'.
' -------------------

Remarques

Un PropertyBuilder est toujours associé à un TypeBuilder. L’TypeBuilderopérateur DefineProperty la méthode retourne un nouveau PropertyBuilder à un client.

Constructeurs

PropertyBuilder()

Initialise une nouvelle instance de la classe PropertyBuilder.

Propriétés

Attributes

Obtient les attributs de cette propriété.

CanRead

Obtient une valeur indiquant si la propriété peut être lue.

CanWrite

Obtient une valeur indiquant s'il est possible d'écrire dans la propriété.

CustomAttributes

Obtient une collection qui contient les attributs personnalisés de ce membre.

(Hérité de MemberInfo)
DeclaringType

Obtient la classe qui déclare ce membre.

GetMethod

Obtient l'accesseur get de cette propriété.

(Hérité de PropertyInfo)
IsCollectible

Obtient une valeur qui indique si cet objet MemberInfo fait partie d’un assembly contenu dans un AssemblyLoadContext pouvant être collecté.

(Hérité de MemberInfo)
IsSpecialName

Obtient une valeur indiquant si la propriété correspond au nom spécial.

(Hérité de PropertyInfo)
MemberType

Obtient une valeur MemberTypes indiquant que ce membre est une propriété.

(Hérité de PropertyInfo)
MetadataToken

Obtient une valeur qui identifie un élément de métadonnées.

(Hérité de MemberInfo)
Module

Obtient le module dans lequel le type qui déclare la propriété actuelle est défini.

Module

Obtient le module dans lequel le type qui déclare le membre représenté par le MemberInfo actuel est défini.

(Hérité de MemberInfo)
Name

Obtient le nom de ce membre.

PropertyToken

Récupère le jeton de cette propriété.

PropertyType

Obtient le type du champ de cette propriété.

ReflectedType

Obtient l'objet classe utilisé pour obtenir cette instance de MemberInfo.

ReflectedType

Obtient l'objet classe utilisé pour obtenir cette instance de MemberInfo.

(Hérité de MemberInfo)
SetMethod

Obtient l'accesseur set de cette propriété.

(Hérité de PropertyInfo)

Méthodes

AddOtherMethod(MethodBuilder)

Ajoute une des autres méthodes associées à cette propriété.

AddOtherMethodCore(MethodBuilder)

En cas de substitution dans une classe dérivée, ajoute l’une des autres méthodes associées à cette propriété.

Equals(Object)

Retourne une valeur qui indique si cette instance est égale à un objet spécifié.

(Hérité de PropertyInfo)
GetAccessors()

Retourne un tableau dont les éléments réfléchissent les accesseurs publics get et set de la propriété réfléchie par l’instance actuelle.

(Hérité de PropertyInfo)
GetAccessors(Boolean)

Retourne un tableau d'accesseurs get et set publics et non publics sur cette propriété.

GetAccessors(Boolean)

Retourne un tableau dont les éléments réfléchissent les accesseurs get, set publics et, le cas échéant, non publics, ainsi que d’autres accesseurs de la propriété réfléchie par l’instance actuelle.

(Hérité de PropertyInfo)
GetConstantValue()

Retourne une valeur littérale associée à la propriété par un compilateur.

(Hérité de PropertyInfo)
GetCustomAttributes(Boolean)

Retourne un tableau de tous les attributs personnalisés de cette propriété.

GetCustomAttributes(Boolean)

En cas de substitution dans une classe dérivée, retourne un tableau de tous les attributs personnalisés appliqués à ce membre.

(Hérité de MemberInfo)
GetCustomAttributes(Type, Boolean)

Retourne un tableau des attributs personnalisés identifiés par Type.

GetCustomAttributes(Type, Boolean)

En cas de substitution dans une classe dérivée, retourne un tableau d’attributs personnalisés appliqués à ce membre et identifiés par Type.

(Hérité de MemberInfo)
GetCustomAttributesData()

Renvoie une liste d’objets CustomAttributeData représentant des données sur les attributs qui ont été appliqués au membre cible.

(Hérité de MemberInfo)
GetGetMethod()

Retourne l'accesseur get public de cette propriété.

(Hérité de PropertyInfo)
GetGetMethod(Boolean)

Retourne l'accesseur GET public et non public de cette propriété.

GetGetMethod(Boolean)

En cas de substitution dans une classe dérivée, retourne l'accesseur get public ou non public de cette propriété.

(Hérité de PropertyInfo)
GetHashCode()

Retourne le code de hachage de cette instance.

(Hérité de PropertyInfo)
GetIndexParameters()

Retourne un tableau de tous les paramètres d'index de la propriété.

GetModifiedPropertyType()

Obtient le type modifié de cet objet de propriété.

(Hérité de PropertyInfo)
GetOptionalCustomModifiers()

Retourne un tableau de types représentant les modificateurs personnalisés facultatifs de la propriété.

(Hérité de PropertyInfo)
GetRawConstantValue()

Retourne une valeur littérale associée à la propriété par un compilateur.

(Hérité de PropertyInfo)
GetRequiredCustomModifiers()

Retourne un tableau de types représentant les modificateurs personnalisés requis de la propriété.

(Hérité de PropertyInfo)
GetSetMethod()

Retourne l'accesseur set public de cette propriété.

(Hérité de PropertyInfo)
GetSetMethod(Boolean)

Retourne l'accesseur set public de cette propriété.

GetSetMethod(Boolean)

En cas de substitution dans une classe dérivée, retourne l'accesseur set de cette propriété.

(Hérité de PropertyInfo)
GetType()

Identifie les attributs d'une propriété et permet d'accéder aux métadonnées de propriété.

(Hérité de PropertyInfo)
GetValue(Object)

Retourne la valeur de la propriété d'un objet spécifié.

(Hérité de PropertyInfo)
GetValue(Object, BindingFlags, Binder, Object[], CultureInfo)

Obtient la valeur d'une propriété ayant la liaison, l'index et le CultureInfo spécifiés.

GetValue(Object, BindingFlags, Binder, Object[], CultureInfo)

En cas de substitution dans une classe dérivée, retourne la valeur de propriété d’un objet spécifié qui possède la liaison, l’index et les informations propres à la culture spécifiés.

(Hérité de PropertyInfo)
GetValue(Object, Object[])

Obtient la valeur de la propriété indexée en appelant la méthode de l'accesseur GET de la propriété.

HasSameMetadataDefinitionAs(MemberInfo)

Définit les propriétés d'un type.

(Hérité de MemberInfo)
IsDefined(Type, Boolean)

Indique si une ou plusieurs instances de attributeType sont définies sur cette propriété.

IsDefined(Type, Boolean)

En cas de substitution dans une classe dérivée, indique si un ou plusieurs attributs du type spécifié ou de ses types dérivés sont appliqués à ce membre.

(Hérité de MemberInfo)
MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
SetConstant(Object)

Définit la valeur par défaut de cette propriété.

SetConstantCore(Object)

En cas de substitution dans une classe dérivée, définit la valeur par défaut de cette propriété.

SetCustomAttribute(ConstructorInfo, Byte[])

Définit un attribut personnalisé à l’aide d’un objet blob d’attribut personnalisé spécifié.

SetCustomAttribute(CustomAttributeBuilder)

Définit un attribut personnalisé à l’aide d’un générateur d’attributs personnalisés.

SetCustomAttributeCore(ConstructorInfo, ReadOnlySpan<Byte>)

En cas de substitution dans une classe dérivée, définit un attribut personnalisé sur cet assembly.

SetGetMethod(MethodBuilder)

Définit la méthode qui obtient la valeur de la propriété.

SetGetMethodCore(MethodBuilder)

En cas de substitution dans une classe dérivée, définit la méthode qui obtient la valeur de la propriété.

SetSetMethod(MethodBuilder)

Définit la méthode qui définit la valeur de la propriété.

SetSetMethodCore(MethodBuilder)

En cas de substitution dans une classe dérivée, définit la méthode qui définit la valeur de la propriété.

SetValue(Object, Object)

Définit la valeur de la propriété d'un objet spécifié.

(Hérité de PropertyInfo)
SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo)

Assigne la valeur donnée à la propriété de l'objet désigné.

SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo)

En cas de substitution dans une classe dérivée, définit la valeur de propriété d'un objet spécifié qui possède la liaison, l'index et les informations propres à la culture spécifiés.

(Hérité de PropertyInfo)
SetValue(Object, Object, Object[])

Définit la valeur de la propriété avec des valeurs d'index facultatives pour les propriétés d'index.

ToString()

Retourne une chaîne qui représente l'objet actuel.

(Hérité de Object)

Implémentations d’interfaces explicites

_MemberInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch.

(Hérité de MemberInfo)
_MemberInfo.GetType()

Obtient un objet Type représentant la classe MemberInfo.

(Hérité de MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Récupère les informations de type pour un objet, qui peuvent être utilisées ensuite pour obtenir les informations de type d'une interface.

(Hérité de MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32)

Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1).

(Hérité de MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fournit l'accès aux propriétés et aux méthodes exposées par un objet.

(Hérité de MemberInfo)
_PropertyBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch.

_PropertyBuilder.GetTypeInfo(UInt32, UInt32, IntPtr)

Récupère les informations de type pour un objet, qui peuvent être utilisées ensuite pour obtenir les informations de type d'une interface.

_PropertyBuilder.GetTypeInfoCount(UInt32)

Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1).

_PropertyBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fournit l'accès aux propriétés et aux méthodes exposées par un objet.

_PropertyInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch.

(Hérité de PropertyInfo)
_PropertyInfo.GetType()

Obtient un objet Type qui représente le type PropertyInfo.

(Hérité de PropertyInfo)
_PropertyInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Récupère les informations de type pour un objet, qui peuvent être utilisées ensuite pour obtenir les informations de type d'une interface.

(Hérité de PropertyInfo)
_PropertyInfo.GetTypeInfoCount(UInt32)

Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1).

(Hérité de PropertyInfo)
_PropertyInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fournit l'accès aux propriétés et aux méthodes exposées par un objet.

(Hérité de PropertyInfo)
ICustomAttributeProvider.GetCustomAttributes(Boolean)

Retourne un tableau de tous les attributs personnalisés définis sur ce membre, en dehors des attributs nommés, ou un tableau vide s’il n’y a aucun attribut personnalisé.

(Hérité de MemberInfo)
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

Retourne un tableau d’attributs personnalisés définis sur ce membre, identifiés par type, ou un tableau vide s’il n’y a aucun attribut personnalisé de ce type.

(Hérité de MemberInfo)
ICustomAttributeProvider.IsDefined(Type, Boolean)

Indique si une ou plusieurs instances de attributeType sont définies sur ce membre.

(Hérité de MemberInfo)

Méthodes d’extension

GetCustomAttribute(MemberInfo, Type)

Récupère un attribut personnalisé d'un type spécifié qui est appliqué à un membre spécifié.

GetCustomAttribute(MemberInfo, Type, Boolean)

Récupère un attribut personnalisé d'un type spécifié qui est appliqué à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttribute<T>(MemberInfo)

Récupère un attribut personnalisé d'un type spécifié qui est appliqué à un membre spécifié.

GetCustomAttribute<T>(MemberInfo, Boolean)

Récupère un attribut personnalisé d'un type spécifié qui est appliqué à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttributes(MemberInfo)

Récupère une collection d'attributs personnalisés qui sont appliqués à un membre spécifié.

GetCustomAttributes(MemberInfo, Boolean)

Récupère une collection d'attributs personnalisés qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttributes(MemberInfo, Type)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié.

GetCustomAttributes(MemberInfo, Type, Boolean)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

GetCustomAttributes<T>(MemberInfo)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié.

GetCustomAttributes<T>(MemberInfo, Boolean)

Extrait une collection d'attributs personnalisés d'un type spécifié qui sont appliqués à un membre spécifié, et inspecte éventuellement les ancêtres de ce membre.

IsDefined(MemberInfo, Type)

Indique si des attributs personnalisés d'un type spécifié sont appliqués à un membre spécifié.

IsDefined(MemberInfo, Type, Boolean)

Indique si les attributs personnalisés d'un type spécifié sont appliqués à un membre spécifié, et, éventuellement, appliqués à ses ancêtres.

GetMetadataToken(MemberInfo)

Obtient un jeton de métadonnées pour le membre donné, s’il est disponible.

HasMetadataToken(MemberInfo)

Retourne une valeur qui indique si un jeton de métadonnées est disponible pour le membre spécifié.

GetAccessors(PropertyInfo)

Définit les propriétés d'un type.

GetAccessors(PropertyInfo, Boolean)

Définit les propriétés d'un type.

GetGetMethod(PropertyInfo)

Définit les propriétés d'un type.

GetGetMethod(PropertyInfo, Boolean)

Définit les propriétés d'un type.

GetSetMethod(PropertyInfo)

Définit les propriétés d'un type.

GetSetMethod(PropertyInfo, Boolean)

Définit les propriétés d'un type.

S’applique à