Exportar (0) Imprimir
Expandir todo

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)

public abstract string FullName { get; }

Property Value

Type: System.String
The fully qualified name of the Type, including the namespace of the Type but not the assembly; or null 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.

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 null.

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 null. For example, consider the classes Base and Derived in the following code.

public class Base<TBase> { }
public class Derived<TDerived> : Base<TDerived> { }

If you use the BaseType property to obtain the base type of Derived, the FullName property of the resulting Type object returns null. To get a non-null FullName, you can use the GetGenericTypeDefinition method to get the generic type definition.

This property is read-only.

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


using System;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      Type t = typeof(Array);
      outputBlock.Text += String.Format("The full name of the Array type is {0}.", 
         t.FullName) + "\n";
   }
}

/* This code example produces the following output:

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


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft