Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

AppDomain.DefineDynamicAssembly Method (AssemblyName, AssemblyBuilderAccess, IEnumerable<CustomAttributeBuilder>, SecurityContextSource)

Defines a dynamic assembly with the specified name, access mode, and custom attributes, and using the specified source for its security context.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)
public AssemblyBuilder DefineDynamicAssembly(
	AssemblyName name,
	AssemblyBuilderAccess access,
	IEnumerable<CustomAttributeBuilder> assemblyAttributes,
	SecurityContextSource securityContextSource
)

Parameters

name
Type: System.Reflection.AssemblyName
The unique identity of the dynamic assembly.
access
Type: System.Reflection.Emit.AssemblyBuilderAccess
The access mode for the dynamic assembly.
assemblyAttributes
Type: System.Collections.Generic.IEnumerable<CustomAttributeBuilder>
An enumerable list of attributes to be applied to the assembly, or null if there are no attributes.
securityContextSource
Type: System.Security.SecurityContextSource
The source of the security context.

Return Value

Type: System.Reflection.Emit.AssemblyBuilder
A dynamic assembly with the specified name and features.
ExceptionCondition
ArgumentNullException

name is null.

ArgumentException

The Name property of name is null.

-or-

The Name property of name starts with white space, or contains a forward or backward slash.

AppDomainUnloadedException

The operation is attempted on an unloaded application domain.

ArgumentOutOfRangeException

The value of securityContextSource was not one of the enumeration values.

Use this method overload to specify attributes that do not work correctly unless they are applied when a dynamic assembly is created. For example, security attributes such as SecurityTransparentAttribute and SecurityCriticalAttribute do not work correctly if they are added after a dynamic assembly has been created.

This method should be used only to define a dynamic assembly in the current application domain. For more information about this restriction, see the Load(AssemblyName) method overload.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.