Assembly.FullName 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取程序集的显示名称。
public:
virtual property System::String ^ FullName { System::String ^ get(); };
public virtual string FullName { get; }
public virtual string? FullName { get; }
member this.FullName : string
Public Overridable ReadOnly Property FullName As String
属性值
程序集的显示名称。
实现
示例
以下示例检索当前正在执行的程序集的显示名称,以及 Visual Basic) 中 C# Integer
中包含Int32类型 (int
的程序集的显示名称。
using namespace System;
using namespace System::Reflection;
void main()
{
Console::WriteLine("The FullName property (also called the display name) of...");
Console::WriteLine("...the currently executing assembly:");
Console::WriteLine(Assembly::GetExecutingAssembly()->FullName);
Console::WriteLine("...the assembly that contains the Int32 type:");
Console::WriteLine(int::typeid->Assembly->FullName);
}
/* This example produces output similar to the following:
The FullName property (also called the display name) of...
...the currently executing assembly:
ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
...the assembly that contains the Int32 type:
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
using System;
using System.Reflection;
class Example
{
static void Main()
{
Console.WriteLine("The FullName property (also called the display name) of...");
Console.WriteLine("...the currently executing assembly:");
Console.WriteLine(typeof(Example).Assembly.FullName);
Console.WriteLine("...the assembly that contains the Int32 type:");
Console.WriteLine(typeof(int).Assembly.FullName);
}
}
/* This example produces output similar to the following:
The FullName property (also called the display name) of...
...the currently executing assembly:
ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
...the assembly that contains the Int32 type:
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
Imports System.Reflection
Class Example
Shared Sub Main()
Console.WriteLine("The FullName property (also called the display name) of...")
Console.WriteLine("...the currently executing assembly:")
Console.WriteLine(GetType(Example).Assembly.FullName)
Console.WriteLine("...the assembly that contains the Int32 type:")
Console.WriteLine(GetType(Integer).Assembly.FullName)
End Sub
End Class
' This example produces output similar to the following:
'
'The FullName property (also called the display name) of...
'...the currently executing assembly:
'ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
'...the assembly that contains the Int32 type:
'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
注解
有关程序集显示名称格式的说明,请参阅 AssemblyName 。
注意
不建议编写自己的代码来分析显示名称。 相反,将显示名称传递给 AssemblyName 构造函数,该构造函数会对其进行分析并填充新 AssemblyName的相应字段。
在 .NET Framework 版本 2.0 中,处理器体系结构已添加到程序集标识中,并且可以指定为程序集名称字符串的一部分。 但是,出于兼容性原因,属性返回 FullName 的字符串中不包含该属性。 请参阅 AssemblyName.ProcessorArchitecture。