当前位置: 首页>>代码示例>>C#>>正文


C# ModuleBuilder.CreateGlobalFunctions方法代码示例

本文整理汇总了C#中ModuleBuilder.CreateGlobalFunctions方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleBuilder.CreateGlobalFunctions方法的具体用法?C# ModuleBuilder.CreateGlobalFunctions怎么用?C# ModuleBuilder.CreateGlobalFunctions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModuleBuilder的用法示例。


在下文中一共展示了ModuleBuilder.CreateGlobalFunctions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: typeof

 // Methods
 /* private scope */ static void Main()
 {
     Console.WriteLine("CodeTrace was used to record the steps to build a specific assembly.");
     Console.WriteLine("CodeTrace started at 28/06/2010 11:46:26");
     _ct_Product_Name = "TestCodeTrace.Rewrite.exe";
     Dictionary<int, Type> dictionary = new Dictionary<int, Type>();
     dictionary.Add(0, null);
     dictionary.Add(typeof(object).GetHashCode(), typeof(object));
     _ct_SourceTypeHashToTypeLookup = dictionary;
     Dictionary<int, MethodBuilder> dictionary2 = new Dictionary<int, MethodBuilder>();
     dictionary2.Add(0, null);
     _ct_SourceMethodHashToMethodBuilderLookup = dictionary2;
     _ct_SourceMethodHashToILGeneratorLookup = new Dictionary<int, Func<ILGenerator>>();
     a = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(Path.GetFileNameWithoutExtension(_ct_Product_Name)), AssemblyBuilderAccess.RunAndSave, @"W:\jsc.svn\examples\rewrite\TestCodeTrace\TestCodeTrace\bin\Debug\staging");
     m = a.DefineDynamicModule(Path.GetFileNameWithoutExtension(_ct_Product_Name), "~TestCodeTrace.Rewrite.exe");
     DefineTypeName = "TestCodeTrace.Program";
     Console.WriteLine("CodeTrace DefineType " + DefineTypeName);
     DeclaringType = m.DefineType(DefineTypeName, TypeAttributes.BeforeFieldInit, _ct_SourceTypeHashToTypeLookup[0], new Type[0]);
     _ct_SourceTypeHashToTypeLookup[0x52a258] = DeclaringType;
     (_ct_SourceTypeHashToTypeLookup[0x52a258] as TypeBuilder).SetParent(_ct_SourceTypeHashToTypeLookup[0x704e84dc]);
     DeclaringMethod = (_ct_SourceTypeHashToTypeLookup[0x52a258] as TypeBuilder).DefineMethod("Main", MethodAttributes.HideBySig | MethodAttributes.Static | MethodAttributes.FamORAssem, CallingConventions.Standard, null, null);
     _ct_SourceMethodHashToMethodBuilderLookup[-1395084204] = DeclaringMethod;
     _ct_SourceMethod = -1395084204;
     _ct_SourceMethodHashToILGeneratorLookup[_ct_SourceMethod] = new Func<ILGenerator>(_ct_SourceMethodHashToMethodBuilderLookup[_ct_SourceMethod].GetILGenerator);
     _ct_SourceMethodHashToILGeneratorLookup[-1395084204]().Emit(OpCodes.Nop);
     _ct_SourceMethodHashToILGeneratorLookup[-1395084204]().Emit(OpCodes.Ret);
     DeclaringMethod = (_ct_SourceTypeHashToTypeLookup[0x52a258] as TypeBuilder).DefineMethod("Method2", MethodAttributes.HideBySig | MethodAttributes.Static | MethodAttributes.Private, CallingConventions.Standard, null, null);
     _ct_SourceMethodHashToMethodBuilderLookup[-1395116976] = DeclaringMethod;
     _ct_SourceMethod = -1395116976;
     _ct_SourceMethodHashToILGeneratorLookup[_ct_SourceMethod] = new Func<ILGenerator>(_ct_SourceMethodHashToMethodBuilderLookup[_ct_SourceMethod].GetILGenerator);
     DefineTypeName = "TestCodeTrace.IDocument`1";
     Console.WriteLine("CodeTrace DefineType " + DefineTypeName);
     DeclaringType = m.DefineType(DefineTypeName, TypeAttributes.BeforeFieldInit | TypeAttributes.Public, _ct_SourceTypeHashToTypeLookup[0], new Type[0]);
     _ct_SourceTypeHashToTypeLookup[0x41330fc] = DeclaringType;
     (_ct_SourceTypeHashToTypeLookup[0x41330fc] as TypeBuilder).SetParent(_ct_SourceTypeHashToTypeLookup[0x704e84dc]);
     _ct_GenericParameters = (_ct_SourceTypeHashToTypeLookup[0x41330fc] as TypeBuilder).DefineGenericParameters(new string[] { "TConstraint1" });
     List<Type> list = new List<Type>();
     foreach (int num in new int[] { 0x704e84dc })
     {
         list.Add(_ct_SourceTypeHashToTypeLookup[num]);
     }
     _ct_DeclaringType = _ct_SourceTypeHashToTypeLookup[0x41330fc].MakeGenericType(list.ToArray());
     _ct_SourceTypeHashToTypeLookup[0x41331e0] = _ct_DeclaringType;
     DefineTypeName = "TestCodeTrace.IXMLDocument";
     Console.WriteLine("CodeTrace DefineType " + DefineTypeName);
     DeclaringType = m.DefineType(DefineTypeName, TypeAttributes.BeforeFieldInit | TypeAttributes.Public, _ct_SourceTypeHashToTypeLookup[0], new Type[0]);
     _ct_SourceTypeHashToTypeLookup[0x4133dec] = DeclaringType;
     (_ct_SourceTypeHashToTypeLookup[0x4133dec] as TypeBuilder).SetParent(_ct_SourceTypeHashToTypeLookup[0x41331e0]);
     DeclaringMethod = (_ct_SourceTypeHashToTypeLookup[0x4133dec] as TypeBuilder).DefineMethod("Method2", MethodAttributes.HideBySig | MethodAttributes.Private, CallingConventions.HasThis | CallingConventions.Standard, null, null);
     _ct_SourceMethodHashToMethodBuilderLookup[-1129754532] = DeclaringMethod;
     _ct_SourceMethod = -1129754532;
     _ct_SourceMethodHashToILGeneratorLookup[_ct_SourceMethod] = new Func<ILGenerator>(_ct_SourceMethodHashToMethodBuilderLookup[_ct_SourceMethod].GetILGenerator);
     _ct_SourceMethodHashToILGeneratorLookup[-1129754532]().Emit(OpCodes.Nop);
     _ct_SourceMethodHashToILGeneratorLookup[-1129754532]().Emit(OpCodes.Ret);
     DeclaringField = (_ct_SourceTypeHashToTypeLookup[0x41330fc] as TypeBuilder).DefineField("__Type1", _ct_SourceTypeHashToTypeLookup[0x4133dec], FieldAttributes.Public);
     Console.WriteLine("CodeTrace CreateType: " + "TestCodeTrace.IDocument`1");
     (_ct_SourceTypeHashToTypeLookup[0x41330fc] as TypeBuilder).CreateType();
     Console.WriteLine("CodeTrace CreateType: " + "TestCodeTrace.IXMLDocument");
     (_ct_SourceTypeHashToTypeLookup[0x4133dec] as TypeBuilder).CreateType();
     _ct_SourceMethodHashToILGeneratorLookup[-1395116976]().Emit(OpCodes.Nop);
     _ct_SourceMethodHashToILGeneratorLookup[-1395116976]().Emit(OpCodes.Ret);
     Console.WriteLine("CodeTrace CreateType: " + "TestCodeTrace.Program");
     (_ct_SourceTypeHashToTypeLookup[0x52a258] as TypeBuilder).CreateType();
     m.CreateGlobalFunctions();
     a.Save("~TestCodeTrace.Rewrite.exe");
     Console.WriteLine("CodeTrace ended at 28/06/2010 11:46:28");
 }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:68,代码来源:Program.cs


注:本文中的ModuleBuilder.CreateGlobalFunctions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。