ConstructorBuilder クラス
アセンブリ: mscorlib (mscorlib.dll 内)
構文
<ClassInterfaceAttribute(ClassInterfaceType.None)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class ConstructorBuilder Inherits ConstructorInfo Implements _ConstructorBuilder
[ClassInterfaceAttribute(ClassInterfaceType.None)] [ComVisibleAttribute(true)] public sealed class ConstructorBuilder : ConstructorInfo, _ConstructorBuilder
[ClassInterfaceAttribute(ClassInterfaceType::None)] [ComVisibleAttribute(true)] public ref class ConstructorBuilder sealed : public ConstructorInfo, _ConstructorBuilder
メモ |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、MayLeakOnAbort です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |
ConstructorBuilder を使用して、MSIL (Microsoft Intermediate Language) のコンストラクタを完全に記述します。名前、属性、シグネチャ、およびコンストラクタ本体が含まれます。TypeBuilder クラスと組み合わせて使用され、実行時にクラスを作成します。DefineConstructor を呼び出して、ConstructorBuilder のインスタンスを取得します。
ConstructorBuilder の実際の使用方法を次のコード例に示します。
Imports System 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 'Main End Class 'TestCtorBuilder ' +++ 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
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 } }
using namespace System; using namespace System::Threading; using namespace System::Reflection; using namespace System::Reflection::Emit; Type^ DynamicPointTypeGen() { Type^ pointType = nullptr; array<Type^>^temp0 = {int::typeid,int::typeid ,int::typeid}; array<Type^>^ctorParams = temp0; AppDomain^ myDomain = Thread::GetDomain(); AssemblyName^ myAsmName = gcnew 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", int::typeid, FieldAttributes::Public ); FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public ); FieldBuilder^ zField = pointTypeBld->DefineField( "z", int::typeid, FieldAttributes::Public ); Type^ objType = Type::GetType( "System.Object" ); ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array<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 bject 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 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. array<String^>^temp1 = {"GetX","GetY","GetZ"}; array<String^>^mthdNames = temp1; System::Collections::IEnumerator^ myEnum = mthdNames->GetEnumerator(); while ( myEnum->MoveNext() ) { String^ mthdName = safe_cast<String^>(myEnum->Current); MethodBuilder^ getFieldMthd = pointTypeBld->DefineMethod( mthdName, MethodAttributes::Public, int::typeid, nullptr ); ILGenerator^ mthdIL = getFieldMthd->GetILGenerator(); mthdIL->Emit( OpCodes::Ldarg_0 ); if ( mthdName->Equals( "GetX" ) ) mthdIL->Emit( OpCodes::Ldfld, xField ); else if ( mthdName->Equals( "GetY" ) ) mthdIL->Emit( OpCodes::Ldfld, yField ); else if ( mthdName->Equals( "GetZ" ) ) mthdIL->Emit( OpCodes::Ldfld, zField ); mthdIL->Emit( OpCodes::Ret ); } pointType = pointTypeBld->CreateType(); // Let's save it, just for posterity. myAsmBuilder->Save( "Point.dll" ); return pointType; } int main() { Type^ myDynamicType = nullptr; Object^ aPoint = nullptr; array<Type^>^temp2 = {int::typeid,int::typeid ,int::typeid}; array<Type^>^aPtypes = temp2; array<Object^>^temp3 = {4,5,6}; array<Object^>^aPargs = temp3; // 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: " ); System::Collections::IEnumerator^ myEnum = myDynamicType->GetMembers()->GetEnumerator(); while ( myEnum->MoveNext() ) { MemberInfo^ member = safe_cast<MemberInfo^>(myEnum->Current); 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 ); 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, nullptr, aPoint, gcnew array<Object^>(0) ) ); Console::WriteLine( "aPoint.y = {0}", myDynamicType->InvokeMember( "GetY", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array<Object^>(0) ) ); Console::WriteLine( "aPoint.z = {0}", myDynamicType->InvokeMember( "GetZ", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array<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 }
System.Reflection.MemberInfo
System.Reflection.MethodBase
System.Reflection.ConstructorInfo
System.Reflection.Emit.ConstructorBuilder
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
ConstructorBuilder プロパティ
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Attributes | オーバーライドされます。 このコンストラクタの属性を取得します。 | |
CallingConvention | オーバーライドされます。 宣言型がジェネリックかどうかに応じて異なる CallingConventions 値を取得します。 | |
ContainsGenericParameters | ジェネリック メソッドに、割り当てられていないジェネリック型パラメータが含まれているかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
DeclaringType | オーバーライドされます。 このメンバを宣言する型の Type オブジェクトへの参照を取得します。 | |
InitLocals | このコンストラクタのローカル変数をゼロで初期化するかどうかを取得または設定します。 | |
IsAbstract | メソッドが抽象メソッドかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsAssembly | 同じアセンブリの異なるクラスからこのメソッドを呼び出すことができるかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsConstructor | メソッドがコンストラクタかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsFamily | このメソッドへのアクセスがクラスのメンバと派生クラスのメンバに制限されているかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsFamilyAndAssembly | 同じアセンブリの派生クラスからこのメソッドを呼び出すことができるかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsFamilyOrAssembly | すべての派生クラスおよび同じアセンブリのすべてのクラスからこのメソッドを呼び出すことができるかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsFinal | このメソッドが final かどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsGenericMethod | メソッドがジェネリック メソッドかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsGenericMethodDefinition | メソッドがジェネリック メソッドの定義かどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsHideBySig | 派生クラスで、正確に同じシグネチャを持つ同じ種類のメンバだけが隠しメンバになるかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsPrivate | このメンバがプライベートかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsPublic | パブリック メソッドかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsSpecialName | 特別な名前のメソッドかどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsStatic | メソッドが static かどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
IsVirtual | メソッドが virtual かどうかを示す値を取得します。 ( MethodBase から継承されます。) | |
MemberType | このメンバがコンストラクタであることを示す MemberTypes 値を取得します。 ( ConstructorInfo から継承されます。) | |
MetadataToken | メタデータ要素を識別する値を取得します。 ( MemberInfo から継承されます。) | |
MethodHandle | オーバーライドされます。 メソッドの内部ハンドルを取得します。基になるメタデータ ハンドルにアクセスするには、このハンドルを使用します。 | |
Module | オーバーライドされます。 このコンストラクタが定義されている動的モジュールを取得します。 | |
Name | オーバーライドされます。 このコンストラクタの名前を取得します。 | |
ReflectedType | オーバーライドされます。 このオブジェクトを取得するために使用した Type オブジェクトへの参照を保持します。 | |
ReturnType | null 参照 (Visual Basic では Nothing) を取得します。 | |
Signature | フィールドのシグネチャを文字列の書式で取得します。 |
ConstructorBuilder メソッド
パブリック メソッド
名前 | 説明 | |
---|---|---|
System.Runtime.InteropServices._ConstructorBuilder.GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 | |
System.Runtime.InteropServices._ConstructorBuilder.GetTypeInfo | オブジェクトの型情報を取得します。その後は、インターフェイスの型情報の取得に使用できます。 | |
System.Runtime.InteropServices._ConstructorBuilder.GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 | |
System.Runtime.InteropServices._ConstructorBuilder.Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |
ConstructorBuilder メンバ
ConstructorBuilder データ型で公開されるメンバを以下の表に示します。
パブリック プロパティ
名前 | 説明 | |
---|---|---|
Attributes | オーバーライドされます。 このコンストラクタの属性を取得します。 | |
CallingConvention | オーバーライドされます。 宣言型がジェネリックかどうかに応じて異なる CallingConventions 値を取得します。 | |
ContainsGenericParameters | ジェネリック メソッドに、割り当てられていないジェネリック型パラメータが含まれているかどうかを示す値を取得します。(MethodBase から継承されます。) | |
DeclaringType | オーバーライドされます。 このメンバを宣言する型の Type オブジェクトへの参照を取得します。 | |
InitLocals | このコンストラクタのローカル変数をゼロで初期化するかどうかを取得または設定します。 | |
IsAbstract | メソッドが抽象メソッドかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsAssembly | 同じアセンブリの異なるクラスからこのメソッドを呼び出すことができるかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsConstructor | メソッドがコンストラクタかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsFamily | このメソッドへのアクセスがクラスのメンバと派生クラスのメンバに制限されているかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsFamilyAndAssembly | 同じアセンブリの派生クラスからこのメソッドを呼び出すことができるかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsFamilyOrAssembly | すべての派生クラスおよび同じアセンブリのすべてのクラスからこのメソッドを呼び出すことができるかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsFinal | このメソッドが final かどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsGenericMethod | メソッドがジェネリック メソッドかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsGenericMethodDefinition | メソッドがジェネリック メソッドの定義かどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsHideBySig | 派生クラスで、正確に同じシグネチャを持つ同じ種類のメンバだけが隠しメンバになるかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsPrivate | このメンバがプライベートかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsPublic | パブリック メソッドかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsSpecialName | 特別な名前のメソッドかどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsStatic | メソッドが static かどうかを示す値を取得します。(MethodBase から継承されます。) | |
IsVirtual | メソッドが virtual かどうかを示す値を取得します。(MethodBase から継承されます。) | |
MemberType | このメンバがコンストラクタであることを示す MemberTypes 値を取得します。(ConstructorInfo から継承されます。) | |
MetadataToken | メタデータ要素を識別する値を取得します。(MemberInfo から継承されます。) | |
MethodHandle | オーバーライドされます。 メソッドの内部ハンドルを取得します。基になるメタデータ ハンドルにアクセスするには、このハンドルを使用します。 | |
Module | オーバーライドされます。 このコンストラクタが定義されている動的モジュールを取得します。 | |
Name | オーバーライドされます。 このコンストラクタの名前を取得します。 | |
ReflectedType | オーバーライドされます。 このオブジェクトを取得するために使用した Type オブジェクトへの参照を保持します。 | |
ReturnType | null 参照 (Visual Basic では Nothing) を取得します。 | |
Signature | フィールドのシグネチャを文字列の書式で取得します。 |
名前 | 説明 | |
---|---|---|
System.Runtime.InteropServices._ConstructorBuilder.GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 | |
System.Runtime.InteropServices._ConstructorBuilder.GetTypeInfo | オブジェクトの型情報を取得します。その後は、インターフェイスの型情報の取得に使用できます。 | |
System.Runtime.InteropServices._ConstructorBuilder.GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 | |
System.Runtime.InteropServices._ConstructorBuilder.Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |
_ConstructorBuilder インターフェイス
アセンブリ: mscorlib (mscorlib.dll 内)
構文
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _ <GuidAttribute("ED3E4384-D7E2-3FA7-8FFD-8940D330519A")> _ <CLSCompliantAttribute(False)> _ <ComVisibleAttribute(True)> _ Public Interface _ConstructorBuilder
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [GuidAttribute("ED3E4384-D7E2-3FA7-8FFD-8940D330519A")] [CLSCompliantAttribute(false)] [ComVisibleAttribute(true)] public interface _ConstructorBuilder
[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown)] [GuidAttribute(L"ED3E4384-D7E2-3FA7-8FFD-8940D330519A")] [CLSCompliantAttribute(false)] [ComVisibleAttribute(true)] public interface class _ConstructorBuilder
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
_ConstructorBuilder メソッド
パブリック メソッド
名前 | 説明 | |
---|---|---|
GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 | |
GetTypeInfo | オブジェクトの型情報を取得します。その後は、インターフェイスの型情報の取得に使用できます。 | |
GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 | |
Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |
_ConstructorBuilder メンバ
System.Reflection.Emit.ConstructorBuilder クラスをアンマネージ コードに公開します。
_ConstructorBuilder データ型で公開されるメンバを以下の表に示します。
パブリック メソッド
名前 | 説明 | |
---|---|---|
GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 | |
GetTypeInfo | オブジェクトの型情報を取得します。その後は、インターフェイスの型情報の取得に使用できます。 | |
GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 | |
Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |
- _ConstructorBuilderのページへのリンク