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


C# AssemblyBuilder.GetDynamicModule方法代码示例

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


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

示例1: ProxyBuilder

        public ProxyBuilder(AssemblyBuilder assembly, Type type)
        {
            module = assembly.GetDynamicModule("Proxies");

            var parent = typeof (ProxyBase);

            newType = module.DefineType(type.FullName, TypeAttributes.Public, parent, new[] { type });
            executeMethod = parent.GetMethod("Execute");
            backingObject = parent.GetField("backingObject");
        }
开发者ID:gja,项目名称:LightProxy,代码行数:10,代码来源:ProxyBuilder.cs

示例2: Initialize

        private void Initialize()
        {
            var currentDomain = AppDomain.CurrentDomain;
            var name = new AssemblyName{Name = "Relinq.Signatures"};
#if DEBUG
            _assembly = currentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.RunAndSave);
            _module = _assembly.GetDynamicModule("Relinq.Signatures.Module") ??
                _assembly.DefineDynamicModule("Relinq.Signatures.Module", "signatures.dll");
#else
            _assembly = currentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
            _module = _assembly.GetDynamicModule("Relinq.Signatures.Module") ??
                _assembly.DefineDynamicModule("Relinq.Signatures.Module");
#endif
        }
开发者ID:xeno-by,项目名称:relinq,代码行数:14,代码来源:DynamicAssemblyHolder.cs

示例3: Initialize

        /// <summary>
        /// Initializes the <see cref="DynamicAssemblyHolder"/>.
        /// </summary>
        private void Initialize()
        {
            // get the current appdomain
            AppDomain ad = AppDomain.CurrentDomain;

            // create a new dynamic assembly
            AssemblyName an = new AssemblyName
            {
                Name = "InterLinq.Types.Anonymous.Assembly",
                Version = new Version("1.0.0.0")
            };

            assembly = ad.DefineDynamicAssembly(an, AssemblyBuilderAccess.Run);

            // create a new module to hold code in the assembly
            ModuleBuilder = assembly.GetDynamicModule("InterLinq.Types.Anonymous.Module") ??
                assembly.DefineDynamicModule("InterLinq.Types.Anonymous.Module");
        }
开发者ID:yallie,项目名称:zyan,代码行数:21,代码来源:DynamicAssemblyHolder.cs

示例4: DynamicAssemblyHolder

        /// <summary>
        /// Private constructor to avoid external instantiation.
        /// </summary>
        private DynamicAssemblyHolder()
        {
            // Get the current AppDomain
            var appDomain = AppDomain.CurrentDomain;

            // Create a new dynamic assembly
            var assemblyName = new AssemblyName
            {
                Name = "CdcSoftware.Shared.IdeaBlade.DynamicTypes",
                Version = new Version("1.0.0.0")
            };

            _assembly = appDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);

            // create a new module to hold code in the assembly
            _moduleBuilder = _assembly.GetDynamicModule("CdcSoftware.Shared.IdeaBlade.DynamicTypes") ??
                             _assembly.DefineDynamicModule("CdcSoftware.Shared.IdeaBlade.DynamicTypes");
        }
开发者ID:john-guo,项目名称:hodgepodge,代码行数:21,代码来源:DynamicAssemblyHolder.cs


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