Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System Namespace
Type Class
Type Properties
 AssemblyQualifiedName Property
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Type..::.AssemblyQualifiedName Property

Updated: November 2007

Gets the assembly-qualified name of the Type, which includes the name of the assembly from which the Type was loaded.

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

Visual Basic (Declaration)
Public MustOverride ReadOnly Property AssemblyQualifiedName As String
Visual Basic (Usage)
Dim instance As Type
Dim value As String

value = instance.AssemblyQualifiedName
C#
public abstract string AssemblyQualifiedName { get; }
Visual C++
public:
virtual property String^ AssemblyQualifiedName {
    String^ get () abstract;
}
J#
/** @property */
public abstract String get_AssemblyQualifiedName()
JScript
public abstract function get AssemblyQualifiedName () : String

Property Value

Type: System..::.String

The assembly-qualified name of the Type, which includes the name of the assembly from which the Type was loaded, or nullNothingnullptra null reference (Nothing in Visual Basic) if the current instance represents a generic type parameter.

Implements

_Type..::.AssemblyQualifiedName

The assembly-qualified name of a type consists of the type name, including its namespace, followed by a comma, followed by the display name of the assembly. The display name of an assembly is obtained using the Assembly..::.FullName property.

Note:

In the .NET Framework version 2.0, processor architecture is added to assembly identity, and can be specified as part of assembly name strings. For example, "ProcessorArchitecture=msil". However, it is not included in the string returned by the AssemblyQualifiedName property, for compatibility reasons. See AssemblyName..::.ProcessorArchitecture.

All compilers that support the common language runtime emit the simple name of a nested class, and reflection constructs a mangled name when queried, in accordance with the following conventions.

Delimiter

Meaning

Backslash (\)

Escape character.

Comma (,)

Precedes the Assembly name.

Plus sign (+)

Precedes a nested class.

Period (.)

Denotes namespace identifiers.

Brackets ([])

After a type name, denotes an array of that type.

-or-

For a generic type, encloses the generic type argument list.

-or-

Within a type argument list, encloses an assembly-qualified type.

For example, the assembly-qualified name for a class might look like this:

TopNamespace.SubNameSpace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089

If the namespace contained a plus sign, for example TopNamespace.Sub+Namespace, then the plus sign (+) would be preceded by an escape character (\) to prevent it from being interpreted as a nesting separator. Reflection would emit this string as follows:

TopNamespace.Sub\+Namespace.ContainingClass+NestedClass, MyAssembly, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089 

A "++" becomes "\+\+", and a "\" becomes "\\".

This qualified name can be persisted and later used to load the Type. To search for and load a Type, use GetType either with the type name only or with the assembly qualified type name. GetType with the type name only will look for the Type in the caller's assembly and then in the System assembly. GetType with the assembly qualified type name will look for the Type in any assembly.

Type names may include trailing characters that denote additional information about the type, such as whether the type is a reference type, a pointer type or an array type. To retrieve the type name without these trailing characters, use t.GetElementType().ToString(), where t is the type.

Spaces are relevant in all type name components except the assembly name. In the assembly name, spaces before the ',' separator are relevant, but spaces after the ',' separator are ignored.

Generic arguments of generic types are themselves qualified by assembly name. For example, in the assembly-qualified type name for MyGenericClass<int> (MyGenericClass(Of Integer) in Visual Basic), int is expanded to the assembly-qualified type name for Int32.

If the current Type object represents a generic parameter, this property returns nullNothingnullptra null reference (Nothing in Visual Basic).

The following example displays the assembly name associated with the class and the fully qualified name of the type.

Visual Basic
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Class MyAssemblyClass
    Public Shared Sub Main()
        Dim objType As Type = GetType(System.Array)
        ' Print the full assembly name.
        Console.WriteLine("Full assembly name: {0}.", objType.Assembly.FullName.ToString())
        ' Print the qualified assembly name.
        Console.WriteLine("Qualified assembly name: {0}.", objType.AssemblyQualifiedName.ToString())
    End Sub 'Main
End Class 'MyAssemblyClass

C#
using System;
using System.Reflection;

class MyAssemblyClass
{

    public static void Main()
    {
        Type objType = typeof(System.Array);

        // Print the full assembly name.
        Console.WriteLine ("Full assembly name: {0}.", objType.Assembly.FullName.ToString()); 

        // Print the qualified assembly name.
        Console.WriteLine ("Qualified assembly name: {0}.", objType.AssemblyQualifiedName.ToString()); 
    }
}

Visual C++
using namespace System;
using namespace System::Reflection;
int main()
{
   Type^ objType = System::Array::typeid;

   // Print the full assembly name.
   Console::WriteLine( "Full assembly name: {0}.", objType->Assembly->FullName );

   // Print the qualified assembly name.
   Console::WriteLine( "Qualified assembly name: {0}.", objType->AssemblyQualifiedName );
}

J#
import System.*;
import System.Reflection.*;

class MyAssemblyClass
{
    public static void main(String[] args)
    {
        Type objType = System.Array.class.ToType();
        // Print the full assembly name.
        Console.WriteLine("Full assembly name: {0}.",
            objType.get_Assembly().get_FullName().ToString());
        // Print the qualified assembly name.
        Console.WriteLine("Qualified assembly name: {0}.",
            objType.get_AssemblyQualifiedName().ToString());
    } //main
} //MyAssemblyClass

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0

XNA Framework

Supported in: 2.0, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker