ConstructorBuilder Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Définit et représente un constructeur d’une classe dynamique.
public ref class ConstructorBuilder sealed : System::Reflection::ConstructorInfo, System::Runtime::InteropServices::_ConstructorBuilder
public ref class ConstructorBuilder sealed : System::Reflection::ConstructorInfo
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
public sealed class ConstructorBuilder : System.Reflection.ConstructorInfo, System.Runtime.InteropServices._ConstructorBuilder
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ConstructorBuilder : System.Reflection.ConstructorInfo, System.Runtime.InteropServices._ConstructorBuilder
public sealed class ConstructorBuilder : System.Reflection.ConstructorInfo
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
type ConstructorBuilder = class
inherit ConstructorInfo
interface _ConstructorBuilder
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ConstructorBuilder = class
inherit ConstructorInfo
interface _ConstructorBuilder
type ConstructorBuilder = class
inherit ConstructorInfo
Public NotInheritable Class ConstructorBuilder
Inherits ConstructorInfo
Implements _ConstructorBuilder
Public NotInheritable Class ConstructorBuilder
Inherits ConstructorInfo
- Héritage
- Attributs
- Implémente
Exemples
L’exemple de code suivant illustre l’utilisation contextuelle d’un ConstructorBuilder.
using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;
class TestCtorBuilder {
public static Type DynamicPointTypeGen() {
Type pointType = null;
Type[] ctorParams = new Type[] {typeof(int),
typeof(int),
typeof(int)};
AppDomain myDomain = Thread.GetDomain();
AssemblyName myAsmName = new AssemblyName();
myAsmName.Name = "MyDynamicAssembly";
AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly(
myAsmName,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder pointModule = myAsmBuilder.DefineDynamicModule("PointModule",
"Point.dll");
TypeBuilder pointTypeBld = pointModule.DefineType("Point",
TypeAttributes.Public);
FieldBuilder xField = pointTypeBld.DefineField("x", typeof(int),
FieldAttributes.Public);
FieldBuilder yField = pointTypeBld.DefineField("y", typeof(int),
FieldAttributes.Public);
FieldBuilder zField = pointTypeBld.DefineField("z", typeof(int),
FieldAttributes.Public);
Type objType = Type.GetType("System.Object");
ConstructorInfo objCtor = objType.GetConstructor(new Type[0]);
ConstructorBuilder pointCtor = pointTypeBld.DefineConstructor(
MethodAttributes.Public,
CallingConventions.Standard,
ctorParams);
ILGenerator ctorIL = pointCtor.GetILGenerator();
// NOTE: ldarg.0 holds the "this" reference - ldarg.1, ldarg.2, and ldarg.3
// hold the actual passed parameters. ldarg.0 is used by instance methods
// to hold a reference to the current calling object instance. Static methods
// do not use arg.0, since they are not instantiated and hence no reference
// is needed to distinguish them.
ctorIL.Emit(OpCodes.Ldarg_0);
// Here, we wish to create an instance of System.Object by invoking its
// constructor, as specified above.
ctorIL.Emit(OpCodes.Call, objCtor);
// Now, we'll load the current instance ref in arg 0, along
// with the value of parameter "x" stored in arg 1, into stfld.
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_1);
ctorIL.Emit(OpCodes.Stfld, xField);
// Now, we store arg 2 "y" in the current instance with stfld.
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_2);
ctorIL.Emit(OpCodes.Stfld, yField);
// Last of all, arg 3 "z" gets stored in the current instance.
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_3);
ctorIL.Emit(OpCodes.Stfld, zField);
// Our work complete, we return.
ctorIL.Emit(OpCodes.Ret);
// Now, let's create three very simple methods so we can see our fields.
string[] mthdNames = new string[] {"GetX", "GetY", "GetZ"};
foreach (string mthdName in mthdNames) {
MethodBuilder getFieldMthd = pointTypeBld.DefineMethod(
mthdName,
MethodAttributes.Public,
typeof(int),
null);
ILGenerator mthdIL = getFieldMthd.GetILGenerator();
mthdIL.Emit(OpCodes.Ldarg_0);
switch (mthdName) {
case "GetX": mthdIL.Emit(OpCodes.Ldfld, xField);
break;
case "GetY": mthdIL.Emit(OpCodes.Ldfld, yField);
break;
case "GetZ": mthdIL.Emit(OpCodes.Ldfld, zField);
break;
}
mthdIL.Emit(OpCodes.Ret);
}
// Finally, we create the type.
pointType = pointTypeBld.CreateType();
// Let's save it, just for posterity.
myAsmBuilder.Save("Point.dll");
return pointType;
}
public static void Main() {
Type myDynamicType = null;
object aPoint = null;
Type[] aPtypes = new Type[] {typeof(int), typeof(int), typeof(int)};
object[] aPargs = new object[] {4, 5, 6};
// Call the method to build our dynamic class.
myDynamicType = DynamicPointTypeGen();
Console.WriteLine("Some information about my new Type '{0}':",
myDynamicType.FullName);
Console.WriteLine("Assembly: '{0}'", myDynamicType.Assembly);
Console.WriteLine("Attributes: '{0}'", myDynamicType.Attributes);
Console.WriteLine("Module: '{0}'", myDynamicType.Module);
Console.WriteLine("Members: ");
foreach (MemberInfo member in myDynamicType.GetMembers()) {
Console.WriteLine("-- {0} {1};", member.MemberType, member.Name);
}
Console.WriteLine("---");
// Let's take a look at the constructor we created.
ConstructorInfo myDTctor = myDynamicType.GetConstructor(aPtypes);
Console.WriteLine("Constructor: {0};", myDTctor.ToString());
Console.WriteLine("---");
// Now, we get to use our dynamically-created class by invoking the constructor.
aPoint = myDTctor.Invoke(aPargs);
Console.WriteLine("aPoint is type {0}.", aPoint.GetType());
// Finally, let's reflect on the instance of our new type - aPoint - and
// make sure everything proceeded according to plan.
Console.WriteLine("aPoint.x = {0}",
myDynamicType.InvokeMember("GetX",
BindingFlags.InvokeMethod,
null,
aPoint,
new object[0]));
Console.WriteLine("aPoint.y = {0}",
myDynamicType.InvokeMember("GetY",
BindingFlags.InvokeMethod,
null,
aPoint,
new object[0]));
Console.WriteLine("aPoint.z = {0}",
myDynamicType.InvokeMember("GetZ",
BindingFlags.InvokeMethod,
null,
aPoint,
new object[0]));
// +++ OUTPUT +++
// Some information about my new Type 'Point':
// Assembly: 'MyDynamicAssembly, Version=0.0.0.0'
// Attributes: 'AutoLayout, AnsiClass, NotPublic, Public'
// Module: 'PointModule'
// Members:
// -- Field x;
// -- Field y;
// -- Field z;
// -- Method GetHashCode;
// -- Method Equals;
// -- Method ToString;
// -- Method GetType;
// -- Constructor .ctor;
// ---
// Constructor: Void .ctor(Int32, Int32, Int32);
// ---
// aPoint is type Point.
// aPoint.x = 4
// aPoint.y = 5
// aPoint.z = 6
}
}
Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit
_
Class TestCtorBuilder
Public Shared Function DynamicPointTypeGen() As Type
Dim pointType As Type = Nothing
Dim ctorParams() As Type = {GetType(Integer), GetType(Integer), GetType(Integer)}
Dim myDomain As AppDomain = Thread.GetDomain()
Dim myAsmName As New AssemblyName()
myAsmName.Name = "MyDynamicAssembly"
Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly(myAsmName, AssemblyBuilderAccess.RunAndSave)
Dim pointModule As ModuleBuilder = myAsmBuilder.DefineDynamicModule("PointModule", "Point.dll")
Dim pointTypeBld As TypeBuilder = pointModule.DefineType("Point", TypeAttributes.Public)
Dim xField As FieldBuilder = pointTypeBld.DefineField("x", GetType(Integer), FieldAttributes.Public)
Dim yField As FieldBuilder = pointTypeBld.DefineField("y", GetType(Integer), FieldAttributes.Public)
Dim zField As FieldBuilder = pointTypeBld.DefineField("z", GetType(Integer), FieldAttributes.Public)
Dim objType As Type = Type.GetType("System.Object")
Dim objCtor As ConstructorInfo = objType.GetConstructor(New Type() {})
Dim pointCtor As ConstructorBuilder = pointTypeBld.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, ctorParams)
Dim ctorIL As ILGenerator = pointCtor.GetILGenerator()
' NOTE: ldarg.0 holds the "this" reference - ldarg.1, ldarg.2, and ldarg.3
' hold the actual passed parameters. ldarg.0 is used by instance methods
' to hold a reference to the current calling object instance. Static methods
' do not use arg.0, since they are not instantiated and hence no reference
' is needed to distinguish them.
ctorIL.Emit(OpCodes.Ldarg_0)
' Here, we wish to create an instance of System.Object by invoking its
' constructor, as specified above.
ctorIL.Emit(OpCodes.Call, objCtor)
' Now, we'll load the current instance ref in arg 0, along
' with the value of parameter "x" stored in arg 1, into stfld.
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_1)
ctorIL.Emit(OpCodes.Stfld, xField)
' Now, we store arg 2 "y" in the current instance with stfld.
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_2)
ctorIL.Emit(OpCodes.Stfld, yField)
' Last of all, arg 3 "z" gets stored in the current instance.
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_3)
ctorIL.Emit(OpCodes.Stfld, zField)
' Our work complete, we return.
ctorIL.Emit(OpCodes.Ret)
' Now, let's create three very simple methods so we can see our fields.
Dim mthdNames() As String = {"GetX", "GetY", "GetZ"}
Dim mthdName As String
For Each mthdName In mthdNames
Dim getFieldMthd As MethodBuilder = pointTypeBld.DefineMethod(mthdName, MethodAttributes.Public, GetType(Integer), Nothing)
Dim mthdIL As ILGenerator = getFieldMthd.GetILGenerator()
mthdIL.Emit(OpCodes.Ldarg_0)
Select Case mthdName
Case "GetX"
mthdIL.Emit(OpCodes.Ldfld, xField)
Case "GetY"
mthdIL.Emit(OpCodes.Ldfld, yField)
Case "GetZ"
mthdIL.Emit(OpCodes.Ldfld, zField)
End Select
mthdIL.Emit(OpCodes.Ret)
Next mthdName
' Finally, we create the type.
pointType = pointTypeBld.CreateType()
' Let's save it, just for posterity.
myAsmBuilder.Save("Point.dll")
Return pointType
End Function 'DynamicPointTypeGen
Public Shared Sub Main()
Dim myDynamicType As Type = Nothing
Dim aPoint As Object = Nothing
Dim aPtypes() As Type = {GetType(Integer), GetType(Integer), GetType(Integer)}
Dim aPargs() As Object = {4, 5, 6}
' Call the method to build our dynamic class.
myDynamicType = DynamicPointTypeGen()
Console.WriteLine("Some information about my new Type '{0}':", myDynamicType.FullName)
Console.WriteLine("Assembly: '{0}'", myDynamicType.Assembly)
Console.WriteLine("Attributes: '{0}'", myDynamicType.Attributes)
Console.WriteLine("Module: '{0}'", myDynamicType.Module)
Console.WriteLine("Members: ")
Dim member As MemberInfo
For Each member In myDynamicType.GetMembers()
Console.WriteLine("-- {0} {1};", member.MemberType, member.Name)
Next member
Console.WriteLine("---")
' Let's take a look at the constructor we created.
Dim myDTctor As ConstructorInfo = myDynamicType.GetConstructor(aPtypes)
Console.WriteLine("Constructor: {0};", myDTctor.ToString())
Console.WriteLine("---")
' Now, we get to use our dynamically-created class by invoking the constructor.
aPoint = myDTctor.Invoke(aPargs)
Console.WriteLine("aPoint is type {0}.", aPoint.GetType())
' Finally, let's reflect on the instance of our new type - aPoint - and
' make sure everything proceeded according to plan.
Console.WriteLine("aPoint.x = {0}", myDynamicType.InvokeMember("GetX", BindingFlags.InvokeMethod, Nothing, aPoint, New Object() {}))
Console.WriteLine("aPoint.y = {0}", myDynamicType.InvokeMember("GetY", BindingFlags.InvokeMethod, Nothing, aPoint, New Object() {}))
Console.WriteLine("aPoint.z = {0}", myDynamicType.InvokeMember("GetZ", BindingFlags.InvokeMethod, Nothing, aPoint, New Object() {}))
End Sub
End Class
' +++ OUTPUT +++
' Some information about my new Type 'Point':
' Assembly: 'MyDynamicAssembly, Version=0.0.0.0'
' Attributes: 'AutoLayout, AnsiClass, NotPublic, Public'
' Module: 'PointModule'
' Members:
' -- Field x;
' -- Field y;
' -- Field z;
' -- Method GetHashCode;
' -- Method Equals;
' -- Method ToString;
' -- Method GetType;
' -- Constructor .ctor;
' ---
' Constructor: Void .ctor(Int32, Int32, Int32);
' ---
' aPoint is type Point.
' aPoint.x = 4
' aPoint.y = 5
' aPoint.z = 6
Remarques
ConstructorBuilder est utilisé pour décrire entièrement un constructeur dans Microsoft langage intermédiaire (MSIL), y compris le nom, les attributs, la signature et le corps du constructeur. Il est utilisé conjointement avec la classe pour créer des classes au moment de l’exécution TypeBuilder . Appel DefineConstructor pour obtenir une instance de ConstructorBuilder.
Si vous ne définissez pas de constructeur pour votre type dynamique, un constructeur sans paramètre est fourni automatiquement et appelle le constructeur sans paramètre de la classe de base.
Si vous utilisez ConstructorBuilder pour définir un constructeur pour votre type dynamique, un constructeur sans paramètre n’est pas fourni. Vous disposez des options suivantes pour fournir un constructeur sans paramètre en plus du constructeur que vous avez défini :
Si vous souhaitez un constructeur sans paramètre qui appelle simplement le constructeur sans paramètre de la classe de base, vous pouvez utiliser la TypeBuilder.DefineDefaultConstructor méthode pour en créer un (et éventuellement restreindre l’accès à celui-ci). Ne fournissez pas d’implémentation pour ce constructeur sans paramètre. Si vous le faites, une exception est levée lorsque vous essayez d’utiliser le constructeur. Aucune exception n’est levée lorsque la TypeBuilder.CreateType méthode est appelée.
Si vous souhaitez un constructeur sans paramètre qui effectue quelque chose de plus que d’appeler simplement le constructeur sans paramètre de la classe de base, ou qui appelle un autre constructeur de la classe de base, ou qui fait quelque chose d’autre entièrement, vous devez utiliser la TypeBuilder.DefineConstructor méthode pour créer un ConstructorBuilder, et fournir votre propre implémentation.
Propriétés
| Nom | Description |
|---|---|
| Attributes |
Obtient les attributs de ce constructeur. |
| CallingConvention |
Obtient une CallingConventions valeur qui varie selon que le type déclarant est générique. |
| CallingConvention |
Obtient une valeur indiquant les conventions d’appel pour cette méthode. (Hérité de MethodBase) |
| ContainsGenericParameters |
Obtient une valeur indiquant si la méthode générique contient des paramètres de type générique non attribués. (Hérité de MethodBase) |
| CustomAttributes |
Obtient une collection qui contient les attributs personnalisés de ce membre. (Hérité de MemberInfo) |
| DeclaringType |
Obtient une référence à l’objet pour le Type type qui déclare ce membre. |
| InitLocals |
Obtient ou définit si les variables locales de ce constructeur doivent être initialisées à zéro. |
| IsAbstract |
Obtient une valeur indiquant si la méthode est abstraite. (Hérité de MethodBase) |
| IsAssembly |
Obtient une valeur indiquant si la visibilité potentielle de cette méthode ou de ce constructeur est décrite par Assembly; autrement dit, la méthode ou le constructeur est visible au maximum par d’autres types dans le même assembly et n’est pas visible par les types dérivés en dehors de l’assembly. (Hérité de MethodBase) |
| IsConstructedGenericMethod |
Définit et représente un constructeur d’une classe dynamique. (Hérité de MethodBase) |
| IsConstructor |
Obtient une valeur indiquant si la méthode est un constructeur. (Hérité de MethodBase) |
| IsFamily |
Obtient une valeur indiquant si la visibilité de cette méthode ou constructeur est décrite par Family; autrement dit, la méthode ou le constructeur est visible uniquement dans sa classe et ses classes dérivées. (Hérité de MethodBase) |
| IsFamilyAndAssembly |
Obtient une valeur indiquant si la visibilité de cette méthode ou constructeur est décrite par FamANDAssem; autrement dit, la méthode ou le constructeur peut être appelé par des classes dérivées, mais uniquement s’ils se trouvent dans le même assembly. (Hérité de MethodBase) |
| IsFamilyOrAssembly |
Obtient une valeur indiquant si la visibilité potentielle de cette méthode ou de ce constructeur est décrite par FamORAssem; autrement dit, la méthode ou le constructeur peut être appelé par des classes dérivées où qu’elles soient, et par des classes dans le même assembly. (Hérité de MethodBase) |
| IsFinal |
Obtient une valeur indiquant si cette méthode est |
| IsGenericMethod |
Obtient une valeur indiquant si la méthode est générique. (Hérité de MethodBase) |
| IsGenericMethodDefinition |
Obtient une valeur indiquant si la méthode est une définition de méthode générique. (Hérité de MethodBase) |
| IsHideBySig |
Obtient une valeur indiquant si seul un membre du même type avec exactement la même signature est masqué dans la classe dérivée. (Hérité de MethodBase) |
| IsPrivate |
Obtient une valeur indiquant si ce membre est privé. (Hérité de MethodBase) |
| IsPublic |
Obtient une valeur indiquant s’il s’agit d’une méthode publique. (Hérité de MethodBase) |
| IsSecurityCritical |
Obtient une valeur qui indique si la méthode ou le constructeur actuel est critique pour la sécurité ou la sécurité au niveau de confiance actuel, et peut donc effectuer des opérations critiques. (Hérité de MethodBase) |
| IsSecuritySafeCritical |
Obtient une valeur qui indique si la méthode ou le constructeur actuel est critique pour la sécurité au niveau de confiance actuel ; autrement dit, qu’il puisse effectuer des opérations critiques et qu’il soit accessible par du code transparent. (Hérité de MethodBase) |
| IsSecurityTransparent |
Obtient une valeur qui indique si la méthode ou le constructeur actuel est transparent au niveau de confiance actuel et ne peut donc pas effectuer d’opérations critiques. (Hérité de MethodBase) |
| IsSpecialName |
Obtient une valeur indiquant si cette méthode a un nom spécial. (Hérité de MethodBase) |
| IsStatic |
Obtient une valeur indiquant si la méthode est |
| IsVirtual |
Obtient une valeur indiquant si la méthode est |
| MemberType |
Obtient une MemberTypes valeur indiquant que ce membre est un constructeur. (Hérité de ConstructorInfo) |
| MetadataToken |
Obtient une valeur qui identifie un élément de métadonnées. (Hérité de MemberInfo) |
| MethodHandle |
Obtient le handle interne de la méthode. Utilisez ce handle pour accéder au handle de métadonnées sous-jacent. |
| MethodImplementationFlags |
Obtient les MethodImplAttributes indicateurs qui spécifient les attributs d’une implémentation de méthode. (Hérité de MethodBase) |
| Module |
Obtient le module dynamique dans lequel ce constructeur est défini. |
| Name |
Récupère le nom de ce constructeur. |
| ReflectedType |
Contient une référence à l’objet Type à partir duquel cet objet a été obtenu. |
| ReturnType |
Obsolète.
Obtient |
| Signature |
Récupère la signature du champ sous la forme d’une chaîne. |
Méthodes
| Nom | Description |
|---|---|
| AddDeclarativeSecurity(SecurityAction, PermissionSet) |
Ajoute une sécurité déclarative à ce constructeur. |
| DefineParameter(Int32, ParameterAttributes, String) |
Définit un paramètre de ce constructeur. |
| Equals(Object) |
Retourne une valeur qui indique si cette instance est égale à un objet spécifié. (Hérité de ConstructorInfo) |
| GetCustomAttributes(Boolean) |
Retourne tous les attributs personnalisés définis pour ce constructeur. |
| GetCustomAttributes(Type, Boolean) |
Retourne les attributs personnalisés identifiés par le type donné. |
| GetCustomAttributesData() |
Retourne 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) |
| GetGenericArguments() |
Retourne un tableau d’objets Type qui représentent les arguments de type d’une méthode générique ou les paramètres de type d’une définition de méthode générique. (Hérité de MethodBase) |
| GetHashCode() |
Retourne le code de hachage pour cette instance. (Hérité de ConstructorInfo) |
| GetILGenerator() |
Obtient un ILGenerator constructeur pour ce constructeur. |
| GetILGenerator(Int32) |
Obtient un ILGenerator objet, avec la taille de flux MSIL spécifiée, qui peut être utilisé pour générer un corps de méthode pour ce constructeur. |
| GetMethodBody() |
En cas de substitution dans une classe dérivée, obtient un MethodBody objet qui fournit l’accès au flux MSIL, aux variables locales et aux exceptions pour la méthode actuelle. (Hérité de MethodBase) |
| GetMethodImplementationFlags() |
Retourne les indicateurs d’implémentation de méthode pour ce constructeur. |
| GetModule() |
Retourne une référence au module qui contient ce constructeur. |
| GetParameters() |
Retourne les paramètres de ce constructeur. |
| GetToken() |
Retourne le MethodToken jeton de ce constructeur. |
| GetType() |
Découvre les attributs d’un constructeur de classe et fournit l’accès aux métadonnées du constructeur. (Hérité de ConstructorInfo) |
| HasSameMetadataDefinitionAs(MemberInfo) |
Définit et représente un constructeur d’une classe dynamique. (Hérité de MemberInfo) |
| Invoke(BindingFlags, Binder, Object[], CultureInfo) |
Appelle dynamiquement le constructeur représenté par cette instance sur l’objet donné, en passant les paramètres spécifiés et sous les contraintes du classeur donné. |
| Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) |
Appelle dynamiquement le constructeur réfléchi par cette instance avec les arguments spécifiés, sous les contraintes du constructeur spécifié |
| Invoke(Object, Object[]) |
Appelle la méthode ou le constructeur représenté par l’instance actuelle à l’aide des paramètres spécifiés. (Hérité de MethodBase) |
| Invoke(Object[]) |
Appelle le constructeur reflété par l’instance qui a les paramètres spécifiés, fournissant des valeurs par défaut pour les paramètres qui ne sont pas couramment utilisés. (Hérité de ConstructorInfo) |
| IsDefined(Type, Boolean) |
Vérifie si le type d’attribut personnalisé spécifié est défini. |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| SetCustomAttribute(ConstructorInfo, Byte[]) |
Définissez un attribut personnalisé à l’aide d’un objet blob d’attributs personnalisé spécifié. |
| SetCustomAttribute(CustomAttributeBuilder) |
Définissez un attribut personnalisé à l’aide d’un générateur d’attributs personnalisé. |
| SetImplementationFlags(MethodImplAttributes) |
Définit les indicateurs d’implémentation de méthode pour ce constructeur. |
| SetMethodBody(Byte[], Int32, Byte[], IEnumerable<ExceptionHandler>, IEnumerable<Int32>) |
Crée le corps du constructeur à l’aide d’un tableau d’octets spécifié de Microsoft instructions MSIL (Intermediate Language). |
| SetSymCustomAttribute(String, Byte[]) |
Définit l’attribut personnalisé de ce constructeur associé aux informations symboliques. |
| ToString() |
Retourne cette ConstructorBuilder instance en tant que String. |
Implémentations d’interfaces explicites
| Nom | Description |
|---|---|
| _ConstructorBuilder.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch. |
| _ConstructorBuilder.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. |
| _ConstructorBuilder.GetTypeInfoCount(UInt32) |
Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1). |
| _ConstructorBuilder.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fournit l’accès aux propriétés et méthodes exposées par un objet. |
| _ConstructorInfo.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch. (Hérité de ConstructorInfo) |
| _ConstructorInfo.GetType() |
Obtient un Type objet représentant le ConstructorInfo type. (Hérité de ConstructorInfo) |
| _ConstructorInfo.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 ConstructorInfo) |
| _ConstructorInfo.GetTypeInfoCount(UInt32) |
Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1). (Hérité de ConstructorInfo) |
| _ConstructorInfo.Invoke_2(Object, BindingFlags, Binder, Object[], CultureInfo) |
Fournit aux objets COM un accès indépendant de la version à la Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) méthode. (Hérité de ConstructorInfo) |
| _ConstructorInfo.Invoke_3(Object, Object[]) |
Fournit aux objets COM un accès indépendant de la version à la Invoke(Object, Object[]) méthode. (Hérité de ConstructorInfo) |
| _ConstructorInfo.Invoke_4(BindingFlags, Binder, Object[], CultureInfo) |
Fournit aux objets COM un accès indépendant de la version à la Invoke(BindingFlags, Binder, Object[], CultureInfo) méthode. (Hérité de ConstructorInfo) |
| _ConstructorInfo.Invoke_5(Object[]) |
Fournit aux objets COM un accès indépendant de la version à la Invoke(Object[]) méthode. (Hérité de ConstructorInfo) |
| _ConstructorInfo.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fournit l’accès aux propriétés et méthodes exposées par un objet. (Hérité de ConstructorInfo) |
| _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 Type objet représentant la MemberInfo classe. (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 méthodes exposées par un objet. (Hérité de MemberInfo) |
| _MethodBase.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch. (Hérité de MethodBase) |
| _MethodBase.GetType() |
Pour obtenir une description de ce membre, consultez GetType(). (Hérité de MethodBase) |
| _MethodBase.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 MethodBase) |
| _MethodBase.GetTypeInfoCount(UInt32) |
Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1). (Hérité de MethodBase) |
| _MethodBase.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fournit l’accès aux propriétés et méthodes exposées par un objet. (Hérité de MethodBase) |
| _MethodBase.IsAbstract |
Pour obtenir une description de ce membre, consultez IsAbstract. (Hérité de MethodBase) |
| _MethodBase.IsAssembly |
Pour obtenir une description de ce membre, consultez IsAssembly. (Hérité de MethodBase) |
| _MethodBase.IsConstructor |
Pour obtenir une description de ce membre, consultez IsConstructor. (Hérité de MethodBase) |
| _MethodBase.IsFamily |
Pour obtenir une description de ce membre, consultez IsFamily. (Hérité de MethodBase) |
| _MethodBase.IsFamilyAndAssembly |
Pour obtenir une description de ce membre, consultez IsFamilyAndAssembly. (Hérité de MethodBase) |
| _MethodBase.IsFamilyOrAssembly |
Pour obtenir une description de ce membre, consultez IsFamilyOrAssembly. (Hérité de MethodBase) |
| _MethodBase.IsFinal |
Pour obtenir une description de ce membre, consultez IsFinal. (Hérité de MethodBase) |
| _MethodBase.IsHideBySig |
Pour obtenir une description de ce membre, consultez IsHideBySig. (Hérité de MethodBase) |
| _MethodBase.IsPrivate |
Pour obtenir une description de ce membre, consultez IsPrivate. (Hérité de MethodBase) |
| _MethodBase.IsPublic |
Pour obtenir une description de ce membre, consultez IsPublic. (Hérité de MethodBase) |
| _MethodBase.IsSpecialName |
Pour obtenir une description de ce membre, consultez IsSpecialName. (Hérité de MethodBase) |
| _MethodBase.IsStatic |
Pour obtenir une description de ce membre, consultez IsStatic. (Hérité de MethodBase) |
| _MethodBase.IsVirtual |
Pour obtenir une description de ce membre, consultez IsVirtual. (Hérité de MethodBase) |
Méthodes d’extension
| Nom | Description |
|---|---|
| GetCustomAttribute(MemberInfo, Type, Boolean) |
Récupère un attribut personnalisé d’un type spécifié appliqué à un membre spécifié et inspecte éventuellement les ancêtres de ce membre. |
| GetCustomAttribute(MemberInfo, Type) |
Récupère un attribut personnalisé d’un type spécifié appliqué à un membre spécifié. |
| GetCustomAttribute<T>(MemberInfo, Boolean) |
Récupère un attribut personnalisé d’un type spécifié 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é appliqué à un membre spécifié. |
| GetCustomAttributes(MemberInfo, Boolean) |
Récupère une collection d’attributs personnalisés appliqués à un membre spécifié et inspecte éventuellement les ancêtres de ce membre. |
| GetCustomAttributes(MemberInfo, Type, Boolean) |
Récupère 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(MemberInfo, Type) |
Récupère une collection d’attributs personnalisés d’un type spécifié qui sont appliqués à un membre spécifié. |
| GetCustomAttributes(MemberInfo) |
Récupère une collection d’attributs personnalisés appliqués à un membre spécifié. |
| GetCustomAttributes<T>(MemberInfo, Boolean) |
Récupère 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) |
Récupère une collection d’attributs personnalisés d’un type spécifié qui 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. |
| IsDefined(MemberInfo, Type) |
Indique si les attributs personnalisés d’un type spécifié sont appliqués à un membre spécifié. |