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
中類型 (int
的元件Int32顯示名稱。
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。