[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mono / tests / codegen-interfaces.cs
blob73e9d2d386be2bd2f81fa824a1d620ebafc558fd
1 using System;
2 using System.Reflection;
3 using System.Reflection.Emit;
5 class CGen {
7 public static int Main() {
8 AssemblyBuilder abuilder;
9 ModuleBuilder mbuilder;
10 TypeBuilder tbuilder;
11 FieldBuilder fbuilder;
12 PropertyBuilder pbuilder;
13 AssemblyName an;
14 String name = "tcgen.exe";
15 MethodBuilder method, get_method;
16 TypeAttributes attrs = TypeAttributes.Public | TypeAttributes.Class;
17 MethodAttributes mattrs = MethodAttributes.Public | MethodAttributes.Static;
18 byte[] body = {0x16, 0x2a}; // ldc.i4.0 ret
20 an = new AssemblyName ();
21 an.Name = name;
22 abuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (an, AssemblyBuilderAccess.Save);
24 mbuilder = abuilder.DefineDynamicModule (name, name);
26 tbuilder = mbuilder.DefineType ("Test.CodeGen", attrs, null, new Type [0]);
27 Type result = typeof(int);
28 Type[] param = new Type[] {typeof (String[])};
29 method = tbuilder.DefineMethod("Main", mattrs, result, param);
30 method.CreateMethodBody (body, body.Length);
32 fbuilder = tbuilder.DefineField ("int_field", typeof(int), FieldAttributes.Private);
33 fbuilder = tbuilder.DefineField ("string_field", typeof(string), FieldAttributes.Public);
34 /*pbuilder = tbuilder.DefineProperty ("FieldI", PropertyAttributes.None, typeof(int), null);
35 get_method = tbuilder.DefineMethod("get_FieldI", MethodAttributes.Public, result, null);
36 get_method.CreateMethodBody (body, body.Length);
37 pbuilder.SetGetMethod (get_method);*/
39 Type t = tbuilder.CreateType ();
40 abuilder.SetEntryPoint (method);
41 abuilder.Save (name);
42 return 0;