PropertyBuilder Classe

Definizione

Definisce le proprietà per un tipo.

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
Ereditarietà
PropertyBuilder
Attributi
Implementazioni

Esempio

Nell'esempio di codice seguente viene illustrato come implementare le proprietà in un tipo dinamico usando un PropertyBuilder oggetto ottenuto tramite TypeBuilder.DefineProperty per creare il framework delle proprietà e un oggetto associato MethodBuilder per implementare la logica IL all'interno della proprietà.

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'.
' -------------------

Commenti

Un PropertyBuilder oggetto è sempre associato a un TypeBuilderoggetto . Oggetto TypeBuilder. DefineProperty il metodo restituirà un nuovo PropertyBuilder a un client.

Costruttori

PropertyBuilder()

Inizializza una nuova istanza della classe PropertyBuilder.

Proprietà

Attributes

Ottiene gli attributi per questa proprietà.

CanRead

Ottiene un valore che indica se è possibile leggere la proprietà.

CanWrite

Ottiene un valore che indica se è possibile scrivere nella proprietà.

CustomAttributes

Ottiene una raccolta che contiene gli attributi personalizzati del membro.

(Ereditato da MemberInfo)
DeclaringType

Ottiene la classe che dichiara questo membro.

GetMethod

Ottiene la funzione di accesso get per questa proprietà.

(Ereditato da PropertyInfo)
IsCollectible

Ottiene un valore che indica se questo oggetto MemberInfo fa parte di un assembly conservato in un AssemblyLoadContext ritirabile.

(Ereditato da MemberInfo)
IsSpecialName

Ottiene un valore che indica se la proprietà è il nome speciale.

(Ereditato da PropertyInfo)
MemberType

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

(Ereditato da PropertyInfo)
MetadataToken

Ottiene un valore che identifica un elemento di metadati.

(Ereditato da MemberInfo)
Module

Ottiene il modulo in cui viene definito il tipo che dichiara la proprietà corrente.

Module

Ottiene il modulo in cui viene definito il tipo che dichiara il membro rappresentato dall'oggetto MemberInfo corrente.

(Ereditato da MemberInfo)
Name

Ottiene il nome del membro.

PropertyToken

Recupera il token per questa proprietà.

PropertyType

Ottiene il tipo del campo di questa proprietà.

ReflectedType

Ottiene l'oggetto classe utilizzato per ottenere questa istanza di MemberInfo.

ReflectedType

Ottiene l'oggetto classe utilizzato per ottenere questa istanza di MemberInfo.

(Ereditato da MemberInfo)
SetMethod

Ottiene la funzione di accesso set per questa proprietà.

(Ereditato da PropertyInfo)

Metodi

AddOtherMethod(MethodBuilder)

Aggiunge uno degli altri metodi associati a questa proprietà.

AddOtherMethodCore(MethodBuilder)

In caso di override in una classe derivata, aggiunge uno degli altri metodi associati a questa proprietà.

Equals(Object)

Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato.

(Ereditato da PropertyInfo)
GetAccessors()

Restituisce una matrice i cui elementi riflettono le funzioni di accesso get e set pubbliche della proprietà riflesse dall'istanza corrente.

(Ereditato da PropertyInfo)
GetAccessors(Boolean)

Restituisce una matrice delle funzioni di accesso get e set pubbliche e non pubbliche su questa proprietà.

GetAccessors(Boolean)

Restituisce una matrice i cui elementi riflettono le funzioni di accesso gete set pubbliche e, se specificato, non pubbliche della proprietà riflesse dall'istanza corrente.

(Ereditato da PropertyInfo)
GetConstantValue()

Restituisce un valore letterale associato alla proprietà da un compilatore.

(Ereditato da PropertyInfo)
GetCustomAttributes(Boolean)

Restituisce una matrice di tutti gli attributi personalizzati per questa proprietà.

GetCustomAttributes(Boolean)

Se sottoposto a override in una classe derivata, restituisce una matrice di tutti gli attributi personalizzati applicati a questo membro.

(Ereditato da MemberInfo)
GetCustomAttributes(Type, Boolean)

Restituisce una matrice di attributi personalizzati identificati dall'oggetto Type.

GetCustomAttributes(Type, Boolean)

Quando viene sottoposto a override in una classe derivata, questo metodo restituisce una matrice di attributi personalizzati applicati a questo membro e identificati da Type.

(Ereditato da MemberInfo)
GetCustomAttributesData()

Restituisce un elenco di oggetti CustomAttributeData che rappresentano i dati relativi agli attributi applicati al membro di destinazione.

(Ereditato da MemberInfo)
GetGetMethod()

Restituisce la funzione di accesso get pubblica per questa proprietà.

(Ereditato da PropertyInfo)
GetGetMethod(Boolean)

Restituisce la funzione di accesso get pubblica e non pubblica per questa proprietà.

GetGetMethod(Boolean)

Quando ne viene eseguito l'override in una classe derivata, restituisce la funzione di accesso get pubblica o non pubblica per la proprietà.

(Ereditato da PropertyInfo)
GetHashCode()

Restituisce il codice hash per l'istanza.

(Ereditato da PropertyInfo)
GetIndexParameters()

Restituisce una matrice di tutti i parametri degli indici per la proprietà.

GetModifiedPropertyType()

Ottiene il tipo modificato di questo oggetto proprietà.

(Ereditato da PropertyInfo)
GetOptionalCustomModifiers()

Restituisce una matrice di tipi che rappresentano i modificatori personalizzati facoltativi della proprietà.

(Ereditato da PropertyInfo)
GetRawConstantValue()

Restituisce un valore letterale associato alla proprietà da un compilatore.

(Ereditato da PropertyInfo)
GetRequiredCustomModifiers()

Restituisce una matrice di tipi che rappresentano i modificatori personalizzati obbligatori della proprietà.

(Ereditato da PropertyInfo)
GetSetMethod()

Restituisce la funzione di accesso set pubblica per questa proprietà.

(Ereditato da PropertyInfo)
GetSetMethod(Boolean)

Restituisce la funzione di accesso set per questa proprietà.

GetSetMethod(Boolean)

Quando ne viene eseguito l'override in una classe derivata, restituisce la funzione di accesso set per questa proprietà.

(Ereditato da PropertyInfo)
GetType()

Individua gli attributi di una proprietà e consente di accedere ai relativi metadati.

(Ereditato da PropertyInfo)
GetValue(Object)

Restituisce il valore della proprietà di un oggetto specificato.

(Ereditato da PropertyInfo)
GetValue(Object, BindingFlags, Binder, Object[], CultureInfo)

Ottiene il valore di una proprietà con l'associazione, l'indice e l'oggetto CultureInfo specificati.

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

Una volta eseguito l'override in una classe derivata, restituisce il valore di proprietà di un oggetto specificato con l'associazione, l'indice e le informazioni specifiche delle impostazioni cultura specificate.

(Ereditato da PropertyInfo)
GetValue(Object, Object[])

Ottiene il valore della proprietà indicizzata chiamando il metodo per il richiamo della proprietà.

HasSameMetadataDefinitionAs(MemberInfo)

Definisce le proprietà per un tipo.

(Ereditato da MemberInfo)
IsDefined(Type, Boolean)

Indica se una o più istanze di attributeType sono definite su questa proprietà.

IsDefined(Type, Boolean)

Quando se ne effettua l'override in una classe derivata, indica se a questo membro sono applicati uno o più attributi del tipo specificato o dei tipi derivati.

(Ereditato da MemberInfo)
MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.

(Ereditato da Object)
SetConstant(Object)

Imposta il valore predefinito di questa proprietà.

SetConstantCore(Object)

In caso di override in una classe derivata, imposta il valore predefinito di questa proprietà.

SetCustomAttribute(ConstructorInfo, Byte[])

Imposta un attributo personalizzato usando un BLOB di attributi personalizzati specificato.

SetCustomAttribute(CustomAttributeBuilder)

Impostare un attributo personalizzato usando un generatore di attributi personalizzati.

SetCustomAttributeCore(ConstructorInfo, ReadOnlySpan<Byte>)

Quando ne viene eseguito l'override in una classe derivata, imposta un attributo personalizzato su questo assembly.

SetGetMethod(MethodBuilder)

Imposta il metodo che ottiene il valore della proprietà.

SetGetMethodCore(MethodBuilder)

In caso di override in una classe derivata, imposta il metodo che ottiene il valore della proprietà.

SetSetMethod(MethodBuilder)

Imposta il metodo che imposta il valore della proprietà.

SetSetMethodCore(MethodBuilder)

In caso di override in una classe derivata, imposta il metodo che imposta il valore della proprietà.

SetValue(Object, Object)

Imposta il valore della proprietà di un oggetto specificato.

(Ereditato da PropertyInfo)
SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo)

Imposta il valore della proprietà per l'oggetto dato sul valore dato.

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

Quando ne viene eseguito l'override in una classe derivata, imposta il valore della proprietà per un oggetto specificato con il binding, l'indice e le informazioni specifiche delle impostazioni cultura indicati.

(Ereditato da PropertyInfo)
SetValue(Object, Object, Object[])

Imposta il valore della proprietà con valori di indice facoltativi per le proprietà dell'indice.

ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Implementazioni dell'interfaccia esplicita

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

Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch.

(Ereditato da MemberInfo)
_MemberInfo.GetType()

Ottiene un oggetto Type che rappresenta la classe MemberInfo.

(Ereditato da MemberInfo)
_MemberInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo relative a un oggetto che può quindi essere usato per ottenere informazioni sul tipo relative a un'interfaccia.

(Ereditato da MemberInfo)
_MemberInfo.GetTypeInfoCount(UInt32)

Recupera il numero delle interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

(Ereditato da MemberInfo)
_MemberInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornisce l'accesso a proprietà e metodi esposti da un oggetto.

(Ereditato da MemberInfo)
_PropertyBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch.

_PropertyBuilder.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo relative a un oggetto che può quindi essere usato per ottenere informazioni sul tipo relative a un'interfaccia.

_PropertyBuilder.GetTypeInfoCount(UInt32)

Recupera il numero delle interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

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

Fornisce l'accesso a proprietà e metodi esposti da un oggetto.

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

Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch.

(Ereditato da PropertyInfo)
_PropertyInfo.GetType()

Ottiene un oggetto Type che rappresenta il tipo PropertyInfo.

(Ereditato da PropertyInfo)
_PropertyInfo.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo relative a un oggetto che può quindi essere usato per ottenere informazioni sul tipo relative a un'interfaccia.

(Ereditato da PropertyInfo)
_PropertyInfo.GetTypeInfoCount(UInt32)

Recupera il numero delle interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

(Ereditato da PropertyInfo)
_PropertyInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornisce l'accesso a proprietà e metodi esposti da un oggetto.

(Ereditato da PropertyInfo)
ICustomAttributeProvider.GetCustomAttributes(Boolean)

Restituisce una matrice di tutti gli attributi personalizzati definiti in questo membro, esclusi gli attributi denominati, oppure una matrice vuota se non sono presenti attributi personalizzati.

(Ereditato da MemberInfo)
ICustomAttributeProvider.GetCustomAttributes(Type, Boolean)

Restituisce una matrice di attributi personalizzati definiti in questo membro, identificati dal tipo o da una matrice vuota, se non sono presenti attributi personalizzati di quel tipo.

(Ereditato da MemberInfo)
ICustomAttributeProvider.IsDefined(Type, Boolean)

Indica se per questo membro sono definite una o più istanze di attributeType.

(Ereditato da MemberInfo)

Metodi di estensione

GetCustomAttribute(MemberInfo, Type)

Recupera una attributo personalizzato di un tipo specificato che viene applicato a un membro specificato.

GetCustomAttribute(MemberInfo, Type, Boolean)

Recupera un attributo personalizzato di un tipo specificato che viene applicato a un membro specificato e verifica facoltativamente i predecessori di tale membro.

GetCustomAttribute<T>(MemberInfo)

Recupera una attributo personalizzato di un tipo specificato che viene applicato a un membro specificato.

GetCustomAttribute<T>(MemberInfo, Boolean)

Recupera un attributo personalizzato di un tipo specificato che viene applicato a un membro specificato e verifica facoltativamente i predecessori di tale membro.

GetCustomAttributes(MemberInfo)

Recupera una raccolta di attributi personalizzati che vengono applicati a un membro specificato.

GetCustomAttributes(MemberInfo, Boolean)

Recupera una raccolta di attributi personalizzati che vengono applicati a un membro specificato e verifica facoltativamente i predecessori di tale membro.

GetCustomAttributes(MemberInfo, Type)

Recupera una raccolta di attributi personalizzati di un tipo specificato che vengono applicati a un membro specificato.

GetCustomAttributes(MemberInfo, Type, Boolean)

Recupera una raccolta di attributi personalizzati di un tipo specificato che vengono applicati a un membro specificato e verifica facoltativamente i predecessori di tale membro.

GetCustomAttributes<T>(MemberInfo)

Recupera una raccolta di attributi personalizzati di un tipo specificato che vengono applicati a un membro specificato.

GetCustomAttributes<T>(MemberInfo, Boolean)

Recupera una raccolta di attributi personalizzati di un tipo specificato che vengono applicati a un membro specificato e verifica facoltativamente i predecessori di tale membro.

IsDefined(MemberInfo, Type)

Indica se vengono applicati attributi personalizzati del tipo specificato a un membro specificato.

IsDefined(MemberInfo, Type, Boolean)

Indica se gli attributi personalizzati di un tipo specificato vengono applicati a un membro specificato e, facoltativamente, ai relativi predecessori.

GetMetadataToken(MemberInfo)

Ottiene un token di metadati per il membro specificato, se disponibile.

HasMetadataToken(MemberInfo)

Restituisce un valore che indica se un token di metadati è disponibile per il membro specificato.

GetAccessors(PropertyInfo)

Definisce le proprietà per un tipo.

GetAccessors(PropertyInfo, Boolean)

Definisce le proprietà per un tipo.

GetGetMethod(PropertyInfo)

Definisce le proprietà per un tipo.

GetGetMethod(PropertyInfo, Boolean)

Definisce le proprietà per un tipo.

GetSetMethod(PropertyInfo)

Definisce le proprietà per un tipo.

GetSetMethod(PropertyInfo, Boolean)

Definisce le proprietà per un tipo.

Si applica a