Class Assembly
Represents an assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.
Inherited Members
Namespace: System.Reflection
Assembly: mscorlib.dll
Syntax
public class Assembly
Constructors
Assembly()
Declaration
public Assembly()
Properties
FullName
Gets the display name of the assembly.
Declaration
public virtual string FullName { get; }
Property Value
Type | Description |
---|---|
string | The display name of the assembly. |
Methods
GetAssembly(Type)
Gets the currently loaded assembly in which the specified type is defined.
Declaration
public static Assembly GetAssembly(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | An object representing a type in the assembly that will be returned. |
Returns
Type | Description |
---|---|
Assembly | The assembly in which the specified type is defined. |
GetExecutingAssembly()
Gets the assembly that contains the code that is currently executing.
Declaration
public static Assembly GetExecutingAssembly()
Returns
Type | Description |
---|---|
Assembly | The assembly that contains the code that is currently executing. |
GetName()
Gets an AssemblyName for this assembly.
Declaration
public AssemblyName GetName()
Returns
Type | Description |
---|---|
AssemblyName | An object that contains the fully parsed display name for this assembly. |
GetSatelliteAssembly(CultureInfo)
Gets the satellite assembly for the specified culture.
Declaration
public Assembly GetSatelliteAssembly(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | The specified culture. |
Returns
Type | Description |
---|---|
Assembly | The specified satellite assembly. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | culture is null. |
ArgumentException |
GetType(string)
Gets the Type object with the specified name in the assembly instance.
Declaration
public virtual Type GetType(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The full name of the type. |
Returns
Type | Description |
---|---|
Type | An object that represents the specified class, or null if the class is not found. |
GetType(string, bool)
Gets the Type object with the specified name in the assembly instance and optionally throws an exception if the type is not found.
Declaration
public virtual Type GetType(string name, bool throwOnError)
Parameters
Type | Name | Description |
---|---|---|
string | name | The full name of the type. |
bool | throwOnError | true to throw an exception if the type is not found; false to return null. |
Returns
Type | Description |
---|---|
Type | An object that represents the specified class. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
GetTypes()
Gets the types defined in this assembly.
Declaration
public virtual Type[] GetTypes()
Returns
Type | Description |
---|---|
Type[] | An array that contains all the types that are defined in this assembly. |
Load(byte[])
Loads the assembly with a common object file format (COFF)-based image containing an emitted assembly. The assembly is loaded into the application domain of the caller.
Declaration
public static Assembly Load(byte[] rawAssembly)
Parameters
Type | Name | Description |
---|---|---|
byte[] | rawAssembly | A byte array that is a COFF-based image containing an emitted assembly. |
Returns
Type | Description |
---|---|
Assembly | The loaded assembly. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
Load(string)
Loads an assembly given the long form of its name.
Declaration
public static Assembly Load(string assemblyString)
Parameters
Type | Name | Description |
---|---|---|
string | assemblyString | The long form of the assembly name. |
Returns
Type | Description |
---|---|
Assembly | The loaded assembly. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | assemblyString is null. |