Type.FullName 属性

获取 Type 的完全限定名,包括 Type 的命名空间,但不包括程序集。

**命名空间:**System
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public MustOverride ReadOnly Property FullName As String
用法
Dim instance As Type
Dim value As String

value = instance.FullName
public abstract string FullName { get; }
public:
virtual property String^ FullName {
    String^ get () abstract;
}
/** @property */
public abstract String get_FullName ()
public abstract function get FullName () : String

属性值

一个包含 Type 的完全限定名的字符串,其中包括 Type 的命名空间但不包括程序集;或者为 空引用(在 Visual Basic 中为 Nothing)(如果当前实例表示泛型类型参数)。

备注

例如,C# 字符串类型的完全限定名为 System.String。这与程序集限定的名称形成对比,后者是完整的名称加上 AssemblyQualifiedName 属性 (Property) 提供的程序集。

如果当前 Type 表示泛型类型,则 FullName 返回的字符串中的类型实参是使用它们的程序集、版本等来限定的 — 尽管该泛型类型本身的字符串表示形式不是由程序集限定的。因此,串联 t.FullName + ", " + t.Assembly.FullName 将产生等效于 t.AssemblyQualifiedName 的结果,对于非泛型类型也是如此。

如果当前 Type 表示泛型类型的类型形参,则此属性 (Property) 将返回 空引用(在 Visual Basic 中为 Nothing)。

此属性 (Property) 为只读。

示例

下面的示例显示指定类型的全称。

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
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);
    }
} 
using namespace System;
int main()
{
   Type^ t = Array::typeid;
   Console::WriteLine( "The full name of the Array type is {0}.", t->FullName );
}
import System.*;

class TestFullName
{
    public static void main(String[] args)
    {
        Type t = Array.class.ToType();
        Console.WriteLine("The full name of the Array type is {0}.", 
            t.get_FullName());
    } //main
} //TestFullName

这段代码产生以下输出:

The full name of the Array type is System.Array

平台

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

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Type 类
Type 成员
System 命名空间
String 类
Namespace
Type.AssemblyQualifiedName 属性
AssemblyName

其他资源

指定完全限定的类型名称