TypeBuilder クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<ClassInterfaceAttribute(ClassInterfaceType.None)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class TypeBuilder Inherits Type Implements _TypeBuilder
[ClassInterfaceAttribute(ClassInterfaceType.None)] [ComVisibleAttribute(true)] public sealed class TypeBuilder : Type, _TypeBuilder
[ClassInterfaceAttribute(ClassInterfaceType::None)] [ComVisibleAttribute(true)] public ref class TypeBuilder sealed : public Type, _TypeBuilder

![]() |
---|
このクラスに適用される HostProtectionAttribute 属性の Resources プロパティの値は、MayLeakOnAbort です。HostProtectionAttribute は、デスクトップ アプリケーション (一般的には、アイコンをダブルクリック、コマンドを入力、またはブラウザに URL を入力して起動するアプリケーション) には影響しません。詳細については、HostProtectionAttribute クラスのトピックまたは「SQL Server プログラミングとホスト保護属性」を参照してください。 |
TypeBuilder は、実行時に動的クラスの作成を制御するために使用するルート クラスです。TypeBuilder は、クラスの定義、メソッドとフィールドの追加、および Runtime 内部でのクラス作成に使用するルーチンのセットを提供します。動的モジュールから新しい TypeBuilder を作成できます。
不完全な型の Type オブジェクトを取得するには、型の名前 ("MyType"、"MyType[]" など) を表す文字列を指定して ModuleBuilder.GetType を使用します。

次のコード例は、TypeBuilder を使用して動的な型を作成する方法を示しています。
Imports System Imports System.Threading Imports System.Reflection Imports System.Reflection.Emit _ Class TestILGenerator Public Shared Function DynamicDotProductGen() As Type Dim ivType 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 = "IntVectorAsm" Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly( _ myAsmName, _ AssemblyBuilderAccess.RunAndSave) Dim IntVectorModule As ModuleBuilder = myAsmBuilder.DefineDynamicModule( _ "IntVectorModule", _ "Vector.dll") Dim ivTypeBld As TypeBuilder = IntVectorModule.DefineType("IntVector", TypeAttributes.Public) Dim xField As FieldBuilder = ivTypeBld.DefineField("x", _ GetType(Integer), _ FieldAttributes.Private) Dim yField As FieldBuilder = ivTypeBld.DefineField("y", _ GetType(Integer), _ FieldAttributes.Private) Dim zField As FieldBuilder = ivTypeBld.DefineField("z", _ GetType(Integer), _ FieldAttributes.Private) Dim objType As Type = Type.GetType("System.Object") Dim objCtor As ConstructorInfo = objType.GetConstructor(New Type() {}) Dim ivCtor As ConstructorBuilder = ivTypeBld.DefineConstructor( _ MethodAttributes.Public, _ CallingConventions.Standard, _ ctorParams) Dim ctorIL As ILGenerator = ivCtor.GetILGenerator() ctorIL.Emit(OpCodes.Ldarg_0) ctorIL.Emit(OpCodes.Call, objCtor) ctorIL.Emit(OpCodes.Ldarg_0) ctorIL.Emit(OpCodes.Ldarg_1) ctorIL.Emit(OpCodes.Stfld, xField) ctorIL.Emit(OpCodes.Ldarg_0) ctorIL.Emit(OpCodes.Ldarg_2) ctorIL.Emit(OpCodes.Stfld, yField) ctorIL.Emit(OpCodes.Ldarg_0) ctorIL.Emit(OpCodes.Ldarg_3) ctorIL.Emit(OpCodes.Stfld, zField) ctorIL.Emit(OpCodes.Ret) ' Now, you'll construct the method find the dot product of two vectors. First, ' let's define the parameters that will be accepted by the method. In this case, ' it's an IntVector itself! Dim dpParams() As Type = {ivTypeBld} ' Here, you create a MethodBuilder containing the ' name, the attributes (public, static, private, and so on), ' the return type (int, in this case), and a array of Type ' indicating the type of each parameter. Since the sole parameter ' is a IntVector, the very class you're creating, you will ' pass in the TypeBuilder (which is derived from Type) instead of ' a Type object for IntVector, avoiding an exception. ' -- This method would be declared in VB.NET as: ' Public Function DotProduct(IntVector aVector) As Integer Dim dotProductMthd As MethodBuilder = ivTypeBld.DefineMethod("DotProduct", _ MethodAttributes.Public, GetType(Integer), _ dpParams) ' A ILGenerator can now be spawned, attached to the MethodBuilder. Dim mthdIL As ILGenerator = dotProductMthd.GetILGenerator() ' Here's the body of our function, in MSIL form. We're going to find the ' "dot product" of the current vector instance with the passed vector ' instance. For reference purposes, the equation is: ' (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product ' First, you'll load the reference to the current instance "this" ' stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent ' instruction, will pop the reference off the stack and look up the ' field "x", specified by the FieldInfo token "xField". mthdIL.Emit(OpCodes.Ldarg_0) mthdIL.Emit(OpCodes.Ldfld, xField) ' That completed, the value stored at field "x" is now atop the stack. ' Now, you'll do the same for the object reference we passed as a ' parameter, stored in argument 1 (ldarg.1). After Ldfld executed , ' you'll have the value stored in field "x" for the passed instance ' atop the stack. mthdIL.Emit(OpCodes.Ldarg_1) mthdIL.Emit(OpCodes.Ldfld, xField) ' There will now be two values atop the stack - the "x" value for the ' current vector instance, and the "x" value for the passed instance. ' You'll now multiply them, and push the result onto the evaluation stack. mthdIL.Emit(OpCodes.Mul_Ovf_Un) ' Now, repeat this for the "y" fields of both vectors. mthdIL.Emit(OpCodes.Ldarg_0) mthdIL.Emit(OpCodes.Ldfld, yField) mthdIL.Emit(OpCodes.Ldarg_1) mthdIL.Emit(OpCodes.Ldfld, yField) mthdIL.Emit(OpCodes.Mul_Ovf_Un) ' At this time, the results of both multiplications should be atop ' the stack. You'll now add them and push the result onto the stack. mthdIL.Emit(OpCodes.Add_Ovf_Un) ' Multiply both "z" field and push the result onto the stack. mthdIL.Emit(OpCodes.Ldarg_0) mthdIL.Emit(OpCodes.Ldfld, zField) mthdIL.Emit(OpCodes.Ldarg_1) mthdIL.Emit(OpCodes.Ldfld, zField) mthdIL.Emit(OpCodes.Mul_Ovf_Un) ' Finally, add the result of multiplying the "z" fields with the ' result of the earlier addition, and push the result - the dot product - ' onto the stack. mthdIL.Emit(OpCodes.Add_Ovf_Un) ' The "ret" opcode will pop the last value from the stack and return it ' to the calling method. You're all done! mthdIL.Emit(OpCodes.Ret) ivType = ivTypeBld.CreateType() Return ivType End Function 'DynamicDotProductGen Public Shared Sub Main() Dim IVType As Type = Nothing Dim aVector1 As Object = Nothing Dim aVector2 As Object = Nothing Dim aVtypes() As Type = {GetType(Integer), GetType(Integer), GetType(Integer)} Dim aVargs1() As Object = {10, 10, 10} Dim aVargs2() As Object = {20, 20, 20} ' Call the method to build our dynamic class. IVType = DynamicDotProductGen() Dim myDTctor As ConstructorInfo = IVType.GetConstructor(aVtypes) aVector1 = myDTctor.Invoke(aVargs1) aVector2 = myDTctor.Invoke(aVargs2) Console.WriteLine("---") Dim passMe(0) As Object passMe(0) = CType(aVector2, Object) Console.WriteLine("(10, 10, 10) . (20, 20, 20) = {0}", _ IVType.InvokeMember("DotProduct", BindingFlags.InvokeMethod, _ Nothing, aVector1, passMe)) End Sub 'Main End Class 'TestILGenerator ' +++ OUTPUT +++ ' --- ' (10, 10, 10) . (20, 20, 20) = 600
using System; using System.Threading; using System.Reflection; using System.Reflection.Emit; class TestILGenerator { public static Type DynamicDotProductGen() { Type ivType = null; Type[] ctorParams = new Type[] { typeof(int) , typeof(int), typeof(int)}; AppDomain myDomain = Thread.GetDomain(); AssemblyName myAsmName = new AssemblyName(); myAsmName.Name = "IntVectorAsm"; AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder IntVectorModule = myAsmBuilder.DefineDynamicModule("IntVectorModule" , "Vector.dll"); TypeBuilder ivTypeBld = IntVectorModule.DefineType("IntVector", TypeAttributes.Public); FieldBuilder xField = ivTypeBld.DefineField("x", typeof(int) , FieldAttributes.Private); FieldBuilder yField = ivTypeBld.DefineField("y", typeof(int), FieldAttributes.Private); FieldBuilder zField = ivTypeBld.DefineField("z", typeof(int) , FieldAttributes.Private); Type objType = Type.GetType("System.Object"); ConstructorInfo objCtor = objType.GetConstructor(new Type[0]); ConstructorBuilder ivCtor = ivTypeBld.DefineConstructor( MethodAttributes.Public, CallingConventions.Standard, ctorParams); ILGenerator ctorIL = ivCtor.GetILGenerator(); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Call, objCtor); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Ldarg_1); ctorIL.Emit(OpCodes.Stfld, xField); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Ldarg_2); ctorIL.Emit(OpCodes.Stfld, yField); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Ldarg_3); ctorIL.Emit(OpCodes.Stfld, zField); ctorIL.Emit(OpCodes.Ret); // This method will find the dot product of the stored vector // with another. Type[] dpParams = new Type[] { ivTypeBld }; // Here, you create a MethodBuilder containing the // name, the attributes (public, static, private, and so on) , // the return type (int, in this case), and a array of Type // indicating the type of each parameter. Since the sole parameter // is a IntVector, the very class you're creating, you will // pass in the TypeBuilder (which is derived from Type) instead of // a Type object for IntVector, avoiding an exception. // -- This method would be declared in C# as: // public int DotProduct(IntVector aVector) MethodBuilder dotProductMthd = ivTypeBld.DefineMethod( "DotProduct", MethodAttributes.Public, typeof(int), dpParams); // A ILGenerator can now be spawned, attached to the MethodBuilder. ILGenerator mthdIL = dotProductMthd.GetILGenerator(); // Here's the body of our function, in MSIL form. We're going to find the // "dot product" of the current vector instance with the passed vector // instance. For reference purposes, the equation is: // (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product // First, you'll load the reference to the current instance "this" // stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent // instruction, will pop the reference off the stack and look up the // field "x", specified by the FieldInfo token "xField". mthdIL.Emit(OpCodes.Ldarg_0); mthdIL.Emit(OpCodes.Ldfld, xField); // That completed, the value stored at field "x" is now atop the stack. // Now, you'll do the same for the object reference we passed as a // parameter, stored in argument 1 (ldarg.1). After Ldfld executed , // you'll have the value stored in field "x" for the passed instance // atop the stack. mthdIL.Emit(OpCodes.Ldarg_1); mthdIL.Emit(OpCodes.Ldfld, xField); // There will now be two values atop the stack - the "x" value for the // current vector instance, and the "x" value for the passed instance. // You'll now multiply them, and push the result onto the evaluation stack. mthdIL.Emit(OpCodes.Mul_Ovf_Un); // Now, repeat this for the "y" fields of both vectors. mthdIL.Emit(OpCodes.Ldarg_0); mthdIL.Emit(OpCodes.Ldfld, yField); mthdIL.Emit(OpCodes.Ldarg_1); mthdIL.Emit(OpCodes.Ldfld, yField); mthdIL.Emit(OpCodes.Mul_Ovf_Un); // At this time, the results of both multiplications should be atop // the stack. You'll now add them and push the result onto the stack. mthdIL.Emit(OpCodes.Add_Ovf_Un); // Multiply both "z" field and push the result onto the stack. mthdIL.Emit(OpCodes.Ldarg_0); mthdIL.Emit(OpCodes.Ldfld, zField); mthdIL.Emit(OpCodes.Ldarg_1); mthdIL.Emit(OpCodes.Ldfld, zField); mthdIL.Emit(OpCodes.Mul_Ovf_Un); // Finally, add the result of multiplying the "z" fields with the // result of the earlier addition, and push the result - the dot product - // onto the stack. mthdIL.Emit(OpCodes.Add_Ovf_Un); // The "ret" opcode will pop the last value from the stack and return it // to the calling method. You're all done! mthdIL.Emit(OpCodes.Ret); ivType = ivTypeBld.CreateType(); return ivType; } public static void Main() { Type IVType = null; object aVector1 = null; object aVector2 = null; Type[] aVtypes = new Type[] {typeof(int), typeof(int), typeof(int)}; object[] aVargs1 = new object[] {10, 10, 10}; object[] aVargs2 = new object[] {20, 20, 20}; // Call the method to build our dynamic class. IVType = DynamicDotProductGen(); Console.WriteLine("---"); ConstructorInfo myDTctor = IVType.GetConstructor(aVtypes); aVector1 = myDTctor.Invoke(aVargs1); aVector2 = myDTctor.Invoke(aVargs2); object[] passMe = new object[1]; passMe[0] = (object)aVector2; Console.WriteLine("(10, 10, 10) . (20, 20, 20) = {0}", IVType.InvokeMember("DotProduct", BindingFlags.InvokeMethod, null, aVector1, passMe)); // +++ OUTPUT +++ // --- // (10, 10, 10) . (20, 20, 20) = 600 } }
using namespace System; using namespace System::Threading; using namespace System::Reflection; using namespace System::Reflection::Emit; Type^ DynamicDotProductGen() { Type^ ivType = nullptr; array<Type^>^temp0 = {int::typeid,int::typeid ,int::typeid}; array<Type^>^ctorParams = temp0; AppDomain^ myDomain = Thread::GetDomain(); AssemblyName^ myAsmName = gcnew AssemblyName; myAsmName->Name = "IntVectorAsm"; AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); ModuleBuilder^ IntVectorModule = myAsmBuilder->DefineDynamicModule( "IntVectorModule", "Vector.dll" ); TypeBuilder^ ivTypeBld = IntVectorModule->DefineType( "IntVector", TypeAttributes::Public ); FieldBuilder^ xField = ivTypeBld->DefineField( "x", int::typeid, FieldAttributes::Private ); FieldBuilder^ yField = ivTypeBld->DefineField( "y", int::typeid, FieldAttributes::Private ); FieldBuilder^ zField = ivTypeBld->DefineField( "z", int::typeid, FieldAttributes::Private ); Type^ objType = Type::GetType( "System.Object" ); ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array<Type^>(0) ); ConstructorBuilder^ ivCtor = ivTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); ILGenerator^ ctorIL = ivCtor->GetILGenerator(); ctorIL->Emit( OpCodes::Ldarg_0 ); ctorIL->Emit( OpCodes::Call, objCtor ); ctorIL->Emit( OpCodes::Ldarg_0 ); ctorIL->Emit( OpCodes::Ldarg_1 ); ctorIL->Emit( OpCodes::Stfld, xField ); ctorIL->Emit( OpCodes::Ldarg_0 ); ctorIL->Emit( OpCodes::Ldarg_2 ); ctorIL->Emit( OpCodes::Stfld, yField ); ctorIL->Emit( OpCodes::Ldarg_0 ); ctorIL->Emit( OpCodes::Ldarg_3 ); ctorIL->Emit( OpCodes::Stfld, zField ); ctorIL->Emit( OpCodes::Ret ); // This method will find the dot product of the stored vector // with another. array<Type^>^temp1 = {ivTypeBld}; array<Type^>^dpParams = temp1; // Here, you create a MethodBuilder containing the // name, the attributes (public, static, private, and so on), // the return type (int, in this case), and a array of Type // indicating the type of each parameter. Since the sole parameter // is a IntVector, the very class you're creating, you will // pass in the TypeBuilder (which is derived from Type) instead of // a Type object for IntVector, avoiding an exception. // -- This method would be declared in C# as: // public int DotProduct(IntVector aVector) MethodBuilder^ dotProductMthd = ivTypeBld->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, dpParams ); // A ILGenerator can now be spawned, attached to the MethodBuilder. ILGenerator^ mthdIL = dotProductMthd->GetILGenerator(); // Here's the body of our function, in MSIL form. We're going to find the // "dot product" of the current vector instance with the passed vector // instance. For reference purposes, the equation is: // (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product // First, you'll load the reference to the current instance "this" // stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent // instruction, will pop the reference off the stack and look up the // field "x", specified by the FieldInfo token "xField". mthdIL->Emit( OpCodes::Ldarg_0 ); mthdIL->Emit( OpCodes::Ldfld, xField ); // That completed, the value stored at field "x" is now atop the stack. // Now, you'll do the same for the Object reference we passed as a // parameter, stored in argument 1 (ldarg.1). After Ldfld executed , // you'll have the value stored in field "x" for the passed instance // atop the stack. mthdIL->Emit( OpCodes::Ldarg_1 ); mthdIL->Emit( OpCodes::Ldfld, xField ); // There will now be two values atop the stack - the "x" value for the // current vector instance, and the "x" value for the passed instance. // You'll now multiply them, and push the result onto the evaluation stack. mthdIL->Emit( OpCodes::Mul_Ovf_Un ); // Now, repeat this for the "y" fields of both vectors. mthdIL->Emit( OpCodes::Ldarg_0 ); mthdIL->Emit( OpCodes::Ldfld, yField ); mthdIL->Emit( OpCodes::Ldarg_1 ); mthdIL->Emit( OpCodes::Ldfld, yField ); mthdIL->Emit( OpCodes::Mul_Ovf_Un ); // At this time, the results of both multiplications should be atop // the stack. You'll now add them and push the result onto the stack. mthdIL->Emit( OpCodes::Add_Ovf_Un ); // Multiply both "z" field and push the result onto the stack. mthdIL->Emit( OpCodes::Ldarg_0 ); mthdIL->Emit( OpCodes::Ldfld, zField ); mthdIL->Emit( OpCodes::Ldarg_1 ); mthdIL->Emit( OpCodes::Ldfld, zField ); mthdIL->Emit( OpCodes::Mul_Ovf_Un ); // Finally, add the result of multiplying the "z" fields with the // result of the earlier addition, and push the result - the dot product - // onto the stack. mthdIL->Emit( OpCodes::Add_Ovf_Un ); // The "ret" opcode will pop the last value from the stack and return it // to the calling method. You're all done! mthdIL->Emit( OpCodes::Ret ); ivType = ivTypeBld->CreateType(); return ivType; } int main() { Type^ IVType = nullptr; Object^ aVector1 = nullptr; Object^ aVector2 = nullptr; array<Type^>^temp2 = {int::typeid,int::typeid ,int::typeid}; array<Type^>^aVtypes = temp2; array<Object^>^temp3 = {10,10,10}; array<Object^>^aVargs1 = temp3; array<Object^>^temp4 = {20,20,20}; array<Object^>^aVargs2 = temp4; // Call the method to build our dynamic class. IVType = DynamicDotProductGen(); Console::WriteLine( "---" ); ConstructorInfo^ myDTctor = IVType->GetConstructor( aVtypes ); aVector1 = myDTctor->Invoke( aVargs1 ); aVector2 = myDTctor->Invoke( aVargs2 ); array<Object^>^passMe = gcnew array<Object^>(1); passMe[ 0 ] = dynamic_cast<Object^>(aVector2); Console::WriteLine( "(10, 10, 10) . (20, 20, 20) = {0}", IVType->InvokeMember( "DotProduct", BindingFlags::InvokeMethod, nullptr, aVector1, passMe ) ); } // +++ OUTPUT +++ // --- // (10, 10, 10) . (20, 20, 20) = 600
import System.*; import System.Threading.*; import System.Reflection.*; import System.Reflection.Emit.*; class TestILGenerator { public static Type DynamicDotProductGen() { Type ivType = null; Type ctorParams[] = new Type[]{int.class.ToType() , int.class.ToType(), int.class.ToType()}; AppDomain myDomain = System.Threading.Thread.GetDomain(); AssemblyName myAsmName = new AssemblyName(); myAsmName.set_Name("IntVectorAsm"); AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly (myAsmName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder IntVectorModule = myAsmBuilder.DefineDynamicModule ("IntVectorModule", "Vector.dll"); TypeBuilder ivTypeBld = IntVectorModule.DefineType("IntVector" , TypeAttributes.Public); FieldBuilder xField = ivTypeBld.DefineField("x", int.class.ToType(), FieldAttributes.Private); FieldBuilder yField = ivTypeBld.DefineField("y", int.class.ToType(), FieldAttributes.Private); FieldBuilder zField = ivTypeBld.DefineField("z", int.class.ToType(), FieldAttributes.Private); Type objType = Type.GetType("System.Object"); ConstructorInfo objCtor = objType.GetConstructor(new Type[0]); ConstructorBuilder ivCtor = ivTypeBld.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, ctorParams); ILGenerator ctorIL = ivCtor.GetILGenerator(); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Call, objCtor); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Ldarg_1); ctorIL.Emit(OpCodes.Stfld, xField); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Ldarg_2); ctorIL.Emit(OpCodes.Stfld, yField); ctorIL.Emit(OpCodes.Ldarg_0); ctorIL.Emit(OpCodes.Ldarg_3); ctorIL.Emit(OpCodes.Stfld, zField); ctorIL.Emit(OpCodes.Ret); // This method will find the dot product of the stored vector // with another. Type dpParams[] = new Type[]{ivTypeBld}; // Here, you create a MethodBuilder containing the // name, the attributes (public, static, private, and so on) , // the return type (int, in this case), and a array of Type // indicating the type of each parameter. Since the sole parameter // is a IntVector, the very class you're creating, you will // pass in the TypeBuilder (which is derived from Type) instead of // a Type object for IntVector, avoiding an exception. // -- This method would be declared in VJ# as: // public int DotProduct(IntVector aVector) MethodBuilder dotProductMthd = ivTypeBld.DefineMethod("DotProduct" , MethodAttributes.Public, int .class.ToType(), dpParams); // A ILGenerator can now be spawned, attached to the MethodBuilder. ILGenerator mthdIL = dotProductMthd.GetILGenerator(); // Here's the body of our function, in MSIL form. We're going to // find the "dot product" of the current vector instance with the // passed vector instance. For reference purposes, the equation is: // (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product // First, you'll load the reference to the current instance "this" // stored in argument 0 (ldarg.0) onto the stack. Ldfld, the // subsequent instruction, will pop the reference off the stack and // look up the field "x",specified by the FieldInfo token "xField". mthdIL.Emit(OpCodes.Ldarg_0); mthdIL.Emit(OpCodes.Ldfld, xField); // That completed, the value stored at field "x" is now atop the // stack.Now, you'll do the same for the object reference we passed // as a parameter, stored in argument 1 (ldarg.1). After Ldfld // executed,you'll have the value stored in field "x" for the // passed instance atop the stack. mthdIL.Emit(OpCodes.Ldarg_1); mthdIL.Emit(OpCodes.Ldfld, xField); // There will now be two values atop the stack - the "x" value for // the current vector instance, and the "x" value for the passed // instance.You'll now multiply them, and push the result onto the // evaluation stack. mthdIL.Emit(OpCodes.Mul_Ovf_Un); // Now, repeat this for the "y" fields of both vectors. mthdIL.Emit(OpCodes.Ldarg_0); mthdIL.Emit(OpCodes.Ldfld, yField); mthdIL.Emit(OpCodes.Ldarg_1); mthdIL.Emit(OpCodes.Ldfld, yField); mthdIL.Emit(OpCodes.Mul_Ovf_Un); // At this time, the results of both multiplications should be atop // the stack. You'll now add them and push the result // onto the stack. mthdIL.Emit(OpCodes.Add_Ovf_Un); // Multiply both "z" field and push the result onto the stack. mthdIL.Emit(OpCodes.Ldarg_0); mthdIL.Emit(OpCodes.Ldfld, zField); mthdIL.Emit(OpCodes.Ldarg_1); mthdIL.Emit(OpCodes.Ldfld, zField); mthdIL.Emit(OpCodes.Mul_Ovf_Un); // Finally, add the result of multiplying the "z" fields with the // result of the earlier addition, and push the result // - the dot product - onto the stack. mthdIL.Emit(OpCodes.Add_Ovf_Un); // The "ret" opcode will pop the last value from the stack and // return it to the calling method. You're all done! mthdIL.Emit(OpCodes.Ret); ivType = ivTypeBld.CreateType(); return ivType ; } //DynamicDotProductGen public static void main(String[] args) { Type ivType = null; Object aVector1 = null; Object aVector2 = null; Type aVtypes[] = new Type[] { int.class.ToType(), int.class.ToType(), int.class.ToType()}; Object aVargs1[] = new Object[] { (Int32)10, (Int32)10, (Int32)10}; Object aVargs2[] = new Object[] { (Int32)20, (Int32)20, (Int32)20}; // Call the method to build our dynamic class. ivType = DynamicDotProductGen(); Console.WriteLine("---"); ConstructorInfo myDTctor = ivType.GetConstructor(aVtypes); aVector1 = myDTctor.Invoke(aVargs1); aVector2 = myDTctor.Invoke(aVargs2); Object passMe[] = new Object[1]; passMe.set_Item(0, ((Object)(aVector2))); Console.WriteLine("(10, 10, 10) . (20, 20, 20) = {0}", ivType.InvokeMember("DotProduct", BindingFlags.InvokeMethod , null, aVector1, passMe)); } //main } //TestILGenerator // +++ OUTPUT +++ // --- // (10, 10, 10) . (20, 20, 20) = 600

System.Reflection.MemberInfo
System.Type
System.Reflection.Emit.TypeBuilder


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TypeBuilder フィールド
TypeBuilder プロパティ

名前 | 説明 | |
---|---|---|
![]() | Assembly | オーバーライドされます。 この型定義が含まれた動的アセンブリを取得します。 |
![]() | AssemblyQualifiedName | オーバーライドされます。 アセンブリの表示名で修飾されたこの型の完全名を返します。 |
![]() | Attributes | Type に関連付けられている属性を取得します。 ( Type から継承されます。) |
![]() | BaseType | オーバーライドされます。 この型の基本型を取得します。 |
![]() | ContainsGenericParameters | 現在の Type オブジェクトが特定の型で置き換えられていない型パラメータを持っているどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | DeclaringMethod | オーバーライドされます。 現在のジェネリック型パラメータを宣言したメソッドを取得します。 |
![]() | DeclaringType | オーバーライドされます。 この型を宣言した型を返します。 |
![]() | DefaultBinder | 既定のバインダへの参照を取得します。このバインダは、InvokeMember によって呼び出される適切なメンバを選択するための内部規則を実装します。 ( Type から継承されます。) |
![]() | FullName | オーバーライドされます。 この型の完全パスを取得します。 |
![]() | GenericParameterAttributes | オーバーライドされます。 現在のジェネリック型パラメータの共変性と特殊な制約を示す値を取得します。 |
![]() | GenericParameterPosition | オーバーライドされます。 パラメータを宣言したジェネリック型の型パラメータ リスト内の型パラメータの位置を取得します。 |
![]() | GUID | オーバーライドされます。 この型の GUID を取得します。 |
![]() | HasElementType | 現在の Type が別の型を包含または参照しているかどうか、つまり現在の Type が配列、ポインタ、または参照渡しかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsAbstract | Type が抽象型で、オーバーライドする必要があるかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsAnsiClass | Type に、文字列書式属性として AnsiClass が選択されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsArray | Type が配列かどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsAutoClass | Type に、文字列書式属性として AutoClass が選択されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsAutoLayout | Type に、クラスのレイアウト属性として AutoLayout が選択されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsByRef | Type が参照渡しかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsClass | Type がクラスであり、値型やインターフェイスでないかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsCOMObject | Type が COM オブジェクトかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsContextful | Type をコンテキスト内で管理できるかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsEnum | 現在の Type が列挙体であるどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsExplicitLayout | Type に、クラスのレイアウト属性として ExplicitLayout が選択されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsGenericParameter | オーバーライドされます。 現在の型がジェネリック型パラメータかどうかを示す値を取得します。 |
![]() | IsGenericType | オーバーライドされます。 現在の型がジェネリック型かどうかを示す値を取得します。 |
![]() | IsGenericTypeDefinition | オーバーライドされます。 現在の TypeBuilder が、他のジェネリック型を構築できるジェネリック型の定義を表しているかどうかを示す値を取得します。 |
![]() | IsImport | Type が ComImportAttribute 属性を持っているかどうかを示す (つまり、COM タイプ ライブラリからインポートされたかどうかを示す) 値を取得します。 ( Type から継承されます。) |
![]() | IsInterface | Type がインターフェイスであり、クラスや値型でないかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsLayoutSequential | Type に、クラスのレイアウト属性として SequentialLayout が選択されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsMarshalByRef | Type が参照渡しでマーシャリングされるかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNested | 現在の Type オブジェクトが、別の型の定義内に入れ子になっている定義で定義された型を表しているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNestedAssembly | Type が入れ子になっていて、それ自体が属するアセンブリ内でだけ参照可能かどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNestedFamANDAssem | Type が入れ子になっていて、それ自体が属するファミリとアセンブリの両方に属しているクラスだけから参照可能かどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNestedFamily | Type が入れ子になっていて、それ自体が属するファミリ内でだけ参照可能かどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNestedFamORAssem | Type が入れ子になっていて、それ自体が属するファミリまたはアセンブリのいずれかに属しているクラスだけから参照可能かどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNestedPrivate | Type が入れ子になっていて、プライベートとして宣言されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNestedPublic | クラスが入れ子になっていて、パブリックとして宣言されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsNotPublic | Type がパブリックとして宣言されていないかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsPointer | Type がポインタかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsPrimitive | Type がプリミティブ型の 1 つかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsPublic | Type がパブリックとして宣言されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsSealed | Type が sealed として宣言されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsSerializable | Type をシリアル化できるかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsSpecialName | Type の名前が特別な処理を必要とするかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsUnicodeClass | Type に、文字列書式属性として UnicodeClass が選択されているかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsValueType | Type が値型かどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | IsVisible | Type にアセンブリの外側のコードからアクセスできるかどうかを示す値を取得します。 ( Type から継承されます。) |
![]() | MemberType | このメンバが型であるか、または入れ子にされた型であるかを示す MemberTypes 値を取得します。 ( Type から継承されます。) |
![]() | MetadataToken | メタデータ要素を識別する値を取得します。 ( MemberInfo から継承されます。) |
![]() | Module | オーバーライドされます。 この型の定義が含まれている動的モジュールを取得します。 |
![]() | Name | オーバーライドされます。 この型の name を取得します。 |
![]() | Namespace | オーバーライドされます。 この TypeBuilder を定義した名前空間を取得します。 |
![]() | PackingSize | この型のパッキング サイズを取得します。 |
![]() | ReflectedType | オーバーライドされます。 この型を取得するために使用した型を返します。 |
![]() | Size | 型の合計サイズを取得します。 |
![]() | StructLayoutAttribute | 現在の型のレイアウトを説明する StructLayoutAttribute を取得します。 ( Type から継承されます。) |
![]() | TypeHandle | オーバーライドされます。 動的モジュールではサポートされません。 |
![]() | TypeInitializer | Type のクラス初期化子を取得します。 ( Type から継承されます。) |
![]() | TypeToken | この型の型トークンを返します。 |
![]() | UnderlyingSystemType | オーバーライドされます。 この TypeBuilder の基になるシステム型を返します。 |

TypeBuilder メソッド

名前 | 説明 | |
---|---|---|
![]() | AddDeclarativeSecurity | この型に宣言セキュリティを追加します。 |
![]() | AddInterfaceImplementation | この型で実装するインターフェイスを追加します。 |
![]() | CreateType | このクラスの Type オブジェクトを作成します。クラスのフィールドとメソッドを定義した後、Type オブジェクトを読み込むために、CreateType を呼び出します。 |
![]() | DefineConstructor | オーバーロードされます。 新しいコンストラクタを動的型に追加します。 |
![]() | DefineDefaultConstructor | 既定のコンストラクタを定義します。ここで定義されたコンストラクタは、親の既定のコンストラクタを呼び出すだけです。 |
![]() | DefineEvent | 指定した名前、属性、およびイベントの種類を使用して、新しいイベントを型に追加します。 |
![]() | DefineField | オーバーロードされます。 新しいフィールドを動的型に追加します。 |
![]() | DefineGenericParameters | 数と名前を指定して、現在の型のジェネリック型パラメータを定義し、制約を設定するために使用できる GenericTypeParameterBuilder オブジェクトの配列を返します。 |
![]() | DefineInitializedData | 移植可能な実行可能 (PE) ファイルの .sdata セクションの初期化済みデータ フィールドを定義します。 |
![]() | DefineMethod | オーバーロードされます。 メソッドを型に追加します。 |
![]() | DefineMethodOverride | 指定したメソッド宣言を実装するメソッド本体を指定します。 |
![]() | DefineNestedType | オーバーロードされます。 入れ子にされた型を定義します。 |
![]() | DefinePInvokeMethod | オーバーロードされます。 PInvoke メソッドを定義します。 |
![]() | DefineProperty | オーバーロードされます。 新しいプロパティを型に追加します。 |
![]() | DefineTypeInitializer | この型の初期化子を定義します。 |
![]() | DefineUninitializedData | 移植可能な実行可能 (PE) ファイルの .sdata セクションの初期化されていないデータ フィールドを定義します。 |
![]() | Equals | オーバーロードされます。 現在の Type の基になるシステム型が、指定した Object または Type の基になるシステム型と同じかどうかを判断します。 ( Type から継承されます。) |
![]() | FindInterfaces | 現在の Type によって実装または継承されているインターフェイスのフィルタ適用済みリストを表す、Type オブジェクトの配列を返します。 ( Type から継承されます。) |
![]() | FindMembers | 指定したメンバ型の MemberInfo オブジェクトの配列にフィルタを適用して返します。 ( Type から継承されます。) |
![]() | GetArrayRank | Array の次元数を取得します。 ( Type から継承されます。) |
![]() | GetConstructor | オーバーロードされます。 指定した基準に一致するコンストラクタを返します。 |
![]() | GetConstructors | オーバーロードされます。 現在の TypeBuilder によって定義されたコンストラクタを返します。 |
![]() | GetCustomAttributes | オーバーロードされます。 オーバーライドされます。 この型に対して定義されているカスタム属性を返します。 |
![]() | GetDefaultMembers | DefaultMemberAttribute が設定されている現在の Type に定義されているメンバを検索します。 ( Type から継承されます。) |
![]() | GetElementType | オーバーライドされます。 このメソッドを呼び出すと、必ず NotSupportedException がスローされます。 |
![]() | GetEvent | オーバーロードされます。 現在の TypeBuilder によって定義されたイベントを返します。 |
![]() | GetEvents | オーバーロードされます。 オーバーライドされます。 現在の TypeBuilder によって定義されたイベントを返します。 |
![]() | GetField | オーバーロードされます。 現在の TypeBuilder によって定義されたフィールドを返します。 |
![]() | GetFields | オーバーロードされます。 現在の TypeBuilder によって定義されたフィールドを返します。 |
![]() | GetGenericArguments | オーバーライドされます。 ジェネリック型の型引数、またはジェネリック型の定義の型パラメータを表す Type オブジェクトの配列を返します。 |
![]() | GetGenericParameterConstraints | 現在のジェネリック型パラメータの制約を表す Type オブジェクトを返します。 ( Type から継承されます。) |
![]() | GetGenericTypeDefinition | オーバーライドされます。 現在の型を取得できるジェネリック型の定義を表す Type オブジェクトを返します。 |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Type から継承されます。) |
![]() | GetInterface | オーバーロードされます。 現在の TypeBuilder によって実装されたインターフェイスを返します。 |
![]() | GetInterfaceMap | オーバーライドされます。 要求したインターフェイスに対するインターフェイスの割り当てを返します。 |
![]() | GetInterfaces | オーバーライドされます。 この型と基本型で実装されているすべてのインターフェイスの配列を返します。 |
![]() | GetMember | オーバーロードされます。 現在の TypeBuilder によって定義されたメンバを返します。 |
![]() | GetMembers | オーバーロードされます。 現在の TypeBuilder によって定義されたメンバを返します。 |
![]() | GetMethod | オーバーロードされます。 指定した基準に一致するメソッドを返します。 |
![]() | GetMethods | オーバーロードされます。 現在の TypeBuilder によって定義されたメソッドを返します。 |
![]() | GetNestedType | オーバーロードされます。 現在の TypeBuilder によって定義された入れ子にされた型を返します。 |
![]() | GetNestedTypes | オーバーロードされます。 現在の TypeBuilder によって定義された入れ子にされた型を返します。 |
![]() | GetProperties | オーバーロードされます。 現在の TypeBuilder によって定義されたプロパティを返します。 |
![]() | GetProperty | オーバーロードされます。 現在の Type の特定のプロパティを取得します。 ( Type から継承されます。) |
![]() | GetType | オーバーロードされます。 指定された型を表す Type オブジェクトを取得します。 ( Type から継承されます。) |
![]() | GetTypeArray | 指定した配列内のオブジェクトの型を取得します。 ( Type から継承されます。) |
![]() | GetTypeCode | 指定した Type の基になる型コードを取得します。 ( Type から継承されます。) |
![]() | GetTypeFromCLSID | オーバーロードされます。 指定したクラス ID (CLSID) に関連付けられている型を取得します。 ( Type から継承されます。) |
![]() | GetTypeFromHandle | 指定した型ハンドルによって参照される型を取得します。 ( Type から継承されます。) |
![]() | GetTypeFromProgID | オーバーロードされます。 指定したプログラム ID (ProgID) に関連付けられている型を取得します。 ( Type から継承されます。) |
![]() | GetTypeHandle | 指定したオブジェクトの Type のハンドルを取得します。 ( Type から継承されます。) |
![]() | InvokeMember | オーバーロードされます。 現在の TypeBuilder によって定義されたメンバを呼び出します。 |
![]() | IsAssignableFrom | オーバーライドされます。 指定した Type のインスタンスを現在の Type のインスタンスに代入できるかどうかを判断します。 |
![]() | IsCreated | 現在の動的型が作成されているかどうかを示す値を返します。 |
![]() | IsDefined | オーバーライドされます。 カスタム属性が現在の型に適用されているかどうかを判断します。 |
![]() | IsInstanceOfType | 指定したオブジェクトが現在の Type のインスタンスかどうかを判断します。 ( Type から継承されます。) |
![]() | IsSubclassOf | オーバーライドされます。 この型が指定した型から派生しているかどうかを判断します。 |
![]() | MakeArrayType | オーバーロードされます。 オーバーライドされます。 現在の型の配列を表す Type オブジェクトを返します。 |
![]() | MakeByRefType | オーバーライドされます。 ref パラメータ (Visual Basic では ByRef) として渡された場合の現在の型を表す Type オブジェクトを返します。 |
![]() | MakeGenericType | オーバーライドされます。 現在のジェネリック型の定義の型パラメータを型の配列の要素に置き換え、その結果である構築された型を返します。 |
![]() | MakePointerType | オーバーライドされます。 現在の型へのアンマネージ ポインタの型を表す Type オブジェクトを返します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ReflectionOnlyGetType | 大文字と小文字を区別する検索を実行し、型が見つからない場合に例外をスローするかどうかを指定して、指定した名前の Type を取得します。型は実行ではなくリフレクションのためだけに読み込まれます。 ( Type から継承されます。) |
![]() | SetCustomAttribute | オーバーロードされます。 カスタム属性を設定します。 |
![]() | SetParent | 現在構築中の型の基本型を設定します。 |
![]() | ToString | オーバーライドされます。 名前空間を含まない型の名前を返します。 |

名前 | 説明 | |
---|---|---|
![]() | System.Runtime.InteropServices._TypeBuilder.GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 |
![]() | System.Runtime.InteropServices._TypeBuilder.GetTypeInfo | オブジェクトの型情報を取得します。その後は、インターフェイスの型情報の取得に使用できます。 |
![]() | System.Runtime.InteropServices._TypeBuilder.GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 |
![]() | System.Runtime.InteropServices._TypeBuilder.Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |

TypeBuilder メンバ
TypeBuilder データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | AddDeclarativeSecurity | この型に宣言セキュリティを追加します。 |
![]() | AddInterfaceImplementation | この型で実装するインターフェイスを追加します。 |
![]() | CreateType | このクラスの Type オブジェクトを作成します。クラスのフィールドとメソッドを定義した後、Type オブジェクトを読み込むために、CreateType を呼び出します。 |
![]() | DefineConstructor | オーバーロードされます。 新しいコンストラクタを動的型に追加します。 |
![]() | DefineDefaultConstructor | 既定のコンストラクタを定義します。ここで定義されたコンストラクタは、親の既定のコンストラクタを呼び出すだけです。 |
![]() | DefineEvent | 指定した名前、属性、およびイベントの種類を使用して、新しいイベントを型に追加します。 |
![]() | DefineField | オーバーロードされます。 新しいフィールドを動的型に追加します。 |
![]() | DefineGenericParameters | 数と名前を指定して、現在の型のジェネリック型パラメータを定義し、制約を設定するために使用できる GenericTypeParameterBuilder オブジェクトの配列を返します。 |
![]() | DefineInitializedData | 移植可能な実行可能 (PE) ファイルの .sdata セクションの初期化済みデータ フィールドを定義します。 |
![]() | DefineMethod | オーバーロードされます。 メソッドを型に追加します。 |
![]() | DefineMethodOverride | 指定したメソッド宣言を実装するメソッド本体を指定します。 |
![]() | DefineNestedType | オーバーロードされます。 入れ子にされた型を定義します。 |
![]() | DefinePInvokeMethod | オーバーロードされます。 PInvoke メソッドを定義します。 |
![]() | DefineProperty | オーバーロードされます。 新しいプロパティを型に追加します。 |
![]() | DefineTypeInitializer | この型の初期化子を定義します。 |
![]() | DefineUninitializedData | 移植可能な実行可能 (PE) ファイルの .sdata セクションの初期化されていないデータ フィールドを定義します。 |
![]() | Equals | オーバーロードされます。 現在の Type の基になるシステム型が、指定した Object または Type の基になるシステム型と同じかどうかを判断します。 (Type から継承されます。) |
![]() | FindInterfaces | 現在の Type によって実装または継承されているインターフェイスのフィルタ適用済みリストを表す、Type オブジェクトの配列を返します。 (Type から継承されます。) |
![]() | FindMembers | 指定したメンバ型の MemberInfo オブジェクトの配列にフィルタを適用して返します。 (Type から継承されます。) |
![]() | GetArrayRank | Array の次元数を取得します。 (Type から継承されます。) |
![]() | GetConstructor | オーバーロードされます。 指定した基準に一致するコンストラクタを返します。 |
![]() | GetConstructors | オーバーロードされます。 現在の TypeBuilder によって定義されたコンストラクタを返します。 |
![]() | GetCustomAttributes | オーバーロードされます。 オーバーライドされます。 この型に対して定義されているカスタム属性を返します。 |
![]() | GetDefaultMembers | DefaultMemberAttribute が設定されている現在の Type に定義されているメンバを検索します。 (Type から継承されます。) |
![]() | GetElementType | オーバーライドされます。 このメソッドを呼び出すと、必ず NotSupportedException がスローされます。 |
![]() | GetEvent | オーバーロードされます。 現在の TypeBuilder によって定義されたイベントを返します。 |
![]() | GetEvents | オーバーロードされます。 オーバーライドされます。 現在の TypeBuilder によって定義されたイベントを返します。 |
![]() | GetField | オーバーロードされます。 現在の TypeBuilder によって定義されたフィールドを返します。 |
![]() | GetFields | オーバーロードされます。 現在の TypeBuilder によって定義されたフィールドを返します。 |
![]() | GetGenericArguments | オーバーライドされます。 ジェネリック型の型引数、またはジェネリック型の定義の型パラメータを表す Type オブジェクトの配列を返します。 |
![]() | GetGenericParameterConstraints | 現在のジェネリック型パラメータの制約を表す Type オブジェクトを返します。 (Type から継承されます。) |
![]() | GetGenericTypeDefinition | オーバーライドされます。 現在の型を取得できるジェネリック型の定義を表す Type オブジェクトを返します。 |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Type から継承されます。) |
![]() | GetInterface | オーバーロードされます。 現在の TypeBuilder によって実装されたインターフェイスを返します。 |
![]() | GetInterfaceMap | オーバーライドされます。 要求したインターフェイスに対するインターフェイスの割り当てを返します。 |
![]() | GetInterfaces | オーバーライドされます。 この型と基本型で実装されているすべてのインターフェイスの配列を返します。 |
![]() | GetMember | オーバーロードされます。 現在の TypeBuilder によって定義されたメンバを返します。 |
![]() | GetMembers | オーバーロードされます。 現在の TypeBuilder によって定義されたメンバを返します。 |
![]() | GetMethod | オーバーロードされます。 指定した基準に一致するメソッドを返します。 |
![]() | GetMethods | オーバーロードされます。 現在の TypeBuilder によって定義されたメソッドを返します。 |
![]() | GetNestedType | オーバーロードされます。 現在の TypeBuilder によって定義された入れ子にされた型を返します。 |
![]() | GetNestedTypes | オーバーロードされます。 現在の TypeBuilder によって定義された入れ子にされた型を返します。 |
![]() | GetProperties | オーバーロードされます。 現在の TypeBuilder によって定義されたプロパティを返します。 |
![]() | GetProperty | オーバーロードされます。 現在の Type の特定のプロパティを取得します。 (Type から継承されます。) |
![]() | GetType | オーバーロードされます。 指定された型を表す Type オブジェクトを取得します。 (Type から継承されます。) |
![]() | GetTypeArray | 指定した配列内のオブジェクトの型を取得します。 (Type から継承されます。) |
![]() | GetTypeCode | 指定した Type の基になる型コードを取得します。 (Type から継承されます。) |
![]() | GetTypeFromCLSID | オーバーロードされます。 指定したクラス ID (CLSID) に関連付けられている型を取得します。 (Type から継承されます。) |
![]() | GetTypeFromHandle | 指定した型ハンドルによって参照される型を取得します。 (Type から継承されます。) |
![]() | GetTypeFromProgID | オーバーロードされます。 指定したプログラム ID (ProgID) に関連付けられている型を取得します。 (Type から継承されます。) |
![]() | GetTypeHandle | 指定したオブジェクトの Type のハンドルを取得します。 (Type から継承されます。) |
![]() | InvokeMember | オーバーロードされます。 現在の TypeBuilder によって定義されたメンバを呼び出します。 |
![]() | IsAssignableFrom | オーバーライドされます。 指定した Type のインスタンスを現在の Type のインスタンスに代入できるかどうかを判断します。 |
![]() | IsCreated | 現在の動的型が作成されているかどうかを示す値を返します。 |
![]() | IsDefined | オーバーライドされます。 カスタム属性が現在の型に適用されているかどうかを判断します。 |
![]() | IsInstanceOfType | 指定したオブジェクトが現在の Type のインスタンスかどうかを判断します。 (Type から継承されます。) |
![]() | IsSubclassOf | オーバーライドされます。 この型が指定した型から派生しているかどうかを判断します。 |
![]() | MakeArrayType | オーバーロードされます。 オーバーライドされます。 現在の型の配列を表す Type オブジェクトを返します。 |
![]() | MakeByRefType | オーバーライドされます。 ref パラメータ (Visual Basic では ByRef) として渡された場合の現在の型を表す Type オブジェクトを返します。 |
![]() | MakeGenericType | オーバーライドされます。 現在のジェネリック型の定義の型パラメータを型の配列の要素に置き換え、その結果である構築された型を返します。 |
![]() | MakePointerType | オーバーライドされます。 現在の型へのアンマネージ ポインタの型を表す Type オブジェクトを返します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ReflectionOnlyGetType | 大文字と小文字を区別する検索を実行し、型が見つからない場合に例外をスローするかどうかを指定して、指定した名前の Type を取得します。型は実行ではなくリフレクションのためだけに読み込まれます。 (Type から継承されます。) |
![]() | SetCustomAttribute | オーバーロードされます。 カスタム属性を設定します。 |
![]() | SetParent | 現在構築中の型の基本型を設定します。 |
![]() | ToString | オーバーライドされます。 名前空間を含まない型の名前を返します。 |

名前 | 説明 | |
---|---|---|
![]() | System.Runtime.InteropServices._TypeBuilder.GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 |
![]() | System.Runtime.InteropServices._TypeBuilder.GetTypeInfo | オブジェクトの型情報を取得します。その後は、インターフェイスの型情報の取得に使用できます。 |
![]() | System.Runtime.InteropServices._TypeBuilder.GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 |
![]() | System.Runtime.InteropServices._TypeBuilder.Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |

_TypeBuilder インターフェイス
アセンブリ: mscorlib (mscorlib.dll 内)

<CLSCompliantAttribute(False)> _ <GuidAttribute("7E5678EE-48B3-3F83-B076-C58543498A58")> _ <InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _ <ComVisibleAttribute(True)> _ Public Interface _TypeBuilder
[CLSCompliantAttribute(false)] [GuidAttribute("7E5678EE-48B3-3F83-B076-C58543498A58")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [ComVisibleAttribute(true)] public interface _TypeBuilder
[CLSCompliantAttribute(false)] [GuidAttribute(L"7E5678EE-48B3-3F83-B076-C58543498A58")] [InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown)] [ComVisibleAttribute(true)] public interface class _TypeBuilder


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


_TypeBuilder メソッド

名前 | 説明 | |
---|---|---|
![]() | GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 |
![]() | GetTypeInfo | オブジェクトの型情報を取得します。インターフェイスの型情報の取得に使用できます。 |
![]() | GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 |
![]() | Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |

_TypeBuilder メンバ
System.Reflection.Emit.TypeBuilder クラスをアンマネージ コードに公開します。
_TypeBuilder データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | GetIDsOfNames | 一連の名前を対応する一連のディスパッチ識別子に割り当てます。 |
![]() | GetTypeInfo | オブジェクトの型情報を取得します。インターフェイスの型情報の取得に使用できます。 |
![]() | GetTypeInfoCount | オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 |
![]() | Invoke | オブジェクトが公開するプロパティおよびメソッドにアクセスできるようにします。 |

- TypeBuilderのページへのリンク