2 using System
.Threading
;
3 using System
.Reflection
;
4 using System
.Reflection
.Emit
;
14 static AssemblyBuilder assembly
;
15 static ModuleBuilder module
;
16 static string ASSEMBLY_NAME
= "MonoTests.System.Reflection.Emit.TypeBuilderTest";
20 AssemblyName assemblyName
= new AssemblyName ();
21 assemblyName
.Name
= ASSEMBLY_NAME
;
24 Thread
.GetDomain ().DefineDynamicAssembly (
25 assemblyName
, AssemblyBuilderAccess
.RunAndSave
, ".");
27 module
= assembly
.DefineDynamicModule ("module1", "Module1.dll");
32 Type gtd
= typeof (A
<>);
33 Type oi
= gtd
.MakeGenericType (gtd
.GetGenericArguments ());
36 Console
.WriteLine ("fully open instantiation of static type not the same of the generic type definition");
41 TypeBuilder tb
= module
.DefineType ("Nullable`1", TypeAttributes
.Public
);
42 Type
[] args
= tb
.DefineGenericParameters ("T");
43 Type type
= tb
.MakeGenericType (args
);
46 Console
.WriteLine ("fully open instantiation of TypeBuilder is the same of the TypeBuilder");
50 Type res
= tb
.CreateType ();
51 Type oires
= res
.MakeGenericType (res
.GetGenericArguments ());
54 Console
.WriteLine ("fully open instantiation not the same of the generic type definition for the TypeBuilder created type");
59 type
.GetConstructors ();
60 } catch (Exception e
) {
61 Console
.WriteLine ("fully open instantiation of TypeBuilder must have GetConstructors working {0}", e
);
67 oires
.GetConstructors ();
68 } catch (Exception e
) {
69 Console
.WriteLine ("fully open instantiation of the TypeBuilder created type must have GetConstructors working {0}", e
);