本文整理汇总了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");
}
示例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
}
示例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");
}
示例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");
}