AssemblyBuilder.DefineDynamicAssembly Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines a dynamic assembly.
Overloads
DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess) |
Defines a dynamic assembly that has the specified name and access rights. |
DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, IEnumerable<CustomAttributeBuilder>) |
Defines a dynamic assembly that has the specified name, access rights, and attributes. |
DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess)
- Source:
- RuntimeAssemblyBuilder.cs
- Source:
- AssemblyBuilder.cs
- Source:
- RuntimeAssemblyBuilder.cs
- Source:
- RuntimeAssemblyBuilder.cs
Defines a dynamic assembly that has the specified name and access rights.
public:
static System::Reflection::Emit::AssemblyBuilder ^ DefineDynamicAssembly(System::Reflection::AssemblyName ^ name, System::Reflection::Emit::AssemblyBuilderAccess access);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Defining a dynamic assembly requires dynamic code.")]
public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access);
public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Defining a dynamic assembly requires dynamic code.")>]
static member DefineDynamicAssembly : System.Reflection.AssemblyName * System.Reflection.Emit.AssemblyBuilderAccess -> System.Reflection.Emit.AssemblyBuilder
static member DefineDynamicAssembly : System.Reflection.AssemblyName * System.Reflection.Emit.AssemblyBuilderAccess -> System.Reflection.Emit.AssemblyBuilder
Public Shared Function DefineDynamicAssembly (name As AssemblyName, access As AssemblyBuilderAccess) As AssemblyBuilder
Parameters
- name
- AssemblyName
The name of the assembly.
- access
- AssemblyBuilderAccess
The access rights of the assembly.
Returns
An object that represents the new assembly.
- Attributes
Remarks
.NET 6+ only: If the CurrentContextualReflectionContext property is null, then the assembly is created in the AssemblyLoadContext of the function that calls DefineDynamicAssembly. Otherwise, it's created with the AssemblyLoadContext specified in CurrentContextualReflectionContext.
Applies to
DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess, IEnumerable<CustomAttributeBuilder>)
- Source:
- RuntimeAssemblyBuilder.cs
- Source:
- AssemblyBuilder.cs
- Source:
- RuntimeAssemblyBuilder.cs
- Source:
- RuntimeAssemblyBuilder.cs
Defines a dynamic assembly that has the specified name, access rights, and attributes.
public:
static System::Reflection::Emit::AssemblyBuilder ^ DefineDynamicAssembly(System::Reflection::AssemblyName ^ name, System::Reflection::Emit::AssemblyBuilderAccess access, System::Collections::Generic::IEnumerable<System::Reflection::Emit::CustomAttributeBuilder ^> ^ assemblyAttributes);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Defining a dynamic assembly requires dynamic code.")]
public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder>? assemblyAttributes);
public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder>? assemblyAttributes);
public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder> assemblyAttributes);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Defining a dynamic assembly requires dynamic code.")>]
static member DefineDynamicAssembly : System.Reflection.AssemblyName * System.Reflection.Emit.AssemblyBuilderAccess * seq<System.Reflection.Emit.CustomAttributeBuilder> -> System.Reflection.Emit.AssemblyBuilder
static member DefineDynamicAssembly : System.Reflection.AssemblyName * System.Reflection.Emit.AssemblyBuilderAccess * seq<System.Reflection.Emit.CustomAttributeBuilder> -> System.Reflection.Emit.AssemblyBuilder
Public Shared Function DefineDynamicAssembly (name As AssemblyName, access As AssemblyBuilderAccess, assemblyAttributes As IEnumerable(Of CustomAttributeBuilder)) As AssemblyBuilder
Parameters
- name
- AssemblyName
The name of the assembly.
- access
- AssemblyBuilderAccess
The access rights of the assembly.
- assemblyAttributes
- IEnumerable<CustomAttributeBuilder>
A collection that contains the attributes of the assembly.
Returns
An object that represents the new assembly.
- Attributes
Remarks
.NET 6+ only: If the CurrentContextualReflectionContext property is null, then the assembly is created in the AssemblyLoadContext of the function that calls DefineDynamicAssembly. Otherwise, it's created with the AssemblyLoadContext specified in CurrentContextualReflectionContext.