.NET Framework Class Library
Type..::.FullName Property

Gets the fully qualified name of the Type, including the namespace of the Type but not the assembly.

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

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

value = instance.FullName
C#
public abstract string FullName { get; }
Visual C++
public:
virtual property String^ FullName {
    String^ get () abstract;
}
JScript
public abstract function get FullName () : String

Property Value

Type: System..::.String
The fully qualified name of the Type, including the namespace of the Type but not the assembly; or nullNothingnullptra null reference (Nothing in Visual Basic) if the current instance represents a generic type parameter, an array type, pointer type, or byref type based on a type parameter, or a generic type that is not a generic type definition but contains unresolved type parameters.

Implements

_Type..::.FullName
Remarks

For example, the fully qualified name of the C# string type is System.String. Contrast this with the assembly-qualified name, which is the full name plus the assembly, provided by the AssemblyQualifiedName property.

If the current Type represents a generic type, the type arguments in the string returned by FullName are qualified by their assembly, version, and so on, even though the string representation of the generic type itself is not qualified by assembly. Thus, concatenating t.FullName + ", " + t.Assembly.FullName produces a result that is equivalent to t.AssemblyQualifiedName, as is the case with types that are not generic.

If the current Type represents a type parameter of a generic type, or an array type, pointer type, or byref type based on a type parameter, this property returns nullNothingnullptra null reference (Nothing in Visual Basic).

If the current type contains generic type parameters that have not been replaced by specific types (that is, the ContainsGenericParameters property returns true), but the type is not a generic type definition (that is, the IsGenericTypeDefinition property returns false), this property returns nullNothingnullptra null reference (Nothing in Visual Basic). For example, consider the classes Base and Derived in the following code.

Visual Basic
Public Class Base(Of TBase)
End Class
Public Class Derived(Of TDerived)
    Inherits Base(Of TDerived)
End Class
C#
public class Base<TBase> { }
public class Derived<TDerived> : Base<TDerived> { }
Visual C++
generic<typename TBase> 
    public ref class Base { };
generic<typename TDerived> 
    public ref class Derived : Base<TDerived> { };

If you use the BaseType property to obtain the base type of Derived, the FullName property of the resulting Type object returns nullNothingnullptra null reference (Nothing in Visual Basic). To get a non-null FullName, you can use the GetGenericTypeDefinition method to get the generic type definition.

This property is read-only.

Examples

The following example displays the full name of the specified type.

Visual Basic
Imports System

Class TestFullName

    Public Shared Sub Main()
        Dim t As Type = GetType(Array)
        Console.WriteLine("The full name of the Array type is {0}.", t.FullName)
    End Sub 'Main
End Class 'TestFullName

' This example produces the following output:
'
'The full name of the Array type is System.Array.
'
C#
using System;
class TestFullName 
{
public static void Main() 
    {
    Type t = typeof(Array);
    Console.WriteLine("The full name of the Array type is {0}.", t.FullName);
    }
} 

/* This example produces the following output:

The full name of the Array type is System.Array.
 */
Visual C++
using namespace System;
int main()
{
   Type^ t = Array::typeid;
   Console::WriteLine( "The full name of the Array type is {0}.", t->FullName );
}

/* This example produces the following output:

The full name of the Array type is System.Array.
 */
Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, 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, Zune

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.
Version Information

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0
See Also

Reference

Other Resources

Tags :


Community Content

David M. Kean - MSFT
Type.FullName returns null for arrays, pointers and references of generic type definitions

There currently is a bug where Type.FullName returns null incorrectly for arrays, pointers and references of generic type definitions.

For a workaround and description of the problem, see: http://davesbox.com/archive/2009/08/21/type-fullname-returning-null-in-the-wrong-situations.aspx

Tags :

Page view tracker