Assembly.GetAssembly Method (Type)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the currently loaded assembly in which the specified type is defined.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

static member GetAssembly : 
        type:Type -> Assembly

Parameters

type
Type: System.Type

An object representing a type in the assembly that will be returned.

Return Value

Type: System.Reflection.Assembly

The assembly in which the specified type is defined.

Exception Condition
ArgumentNullException

type is null.

Calling this method is equivalent to retrieving the value of the Type.Assembly property. However, the Type.Assembly property typically offers superior performance.

In order to call this method, you must have a Type object, which means that the assembly in which the class is defined must already be loaded.

The following example retrieves the assembly that contains the Int32 type and displays its name and file location.

No code example is currently available or this language may not be supported.

ReflectionPermission

when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess

.NET Framework
Available since 1.1
Return to top
Show: