AssemblyName.ToString メソッド
アセンブリの完全名を返します。この名前は表示名とも呼ばれます。
Overrides Public Function ToString() As String
[C#]
public override string ToString();
[C++]
public: String* ToString();
[JScript]
public override function ToString() : String;
戻り値
アセンブリの完全名を表す文字列。アセンブリの完全名を判断できない場合は、クラス名を表します。
解説
返される文字列の書式については、 AssemblyName の説明を参照してください。
使用例
Imports System
Imports System.Reflection
Imports System.Text.RegularExpressions
Imports Microsoft.VisualBasic
Public Class AssemblyName_GetAssemblyName
Public Shared Sub Main()
' Get the type of 'System.Object'.
Dim myType As Type = GetType(System.Object)
' Get the path of 'System.dll'.
Dim system As String = Regex.Replace(myType.Assembly.CodeBase, "mscorlib.dll", "System.dll")
system = Regex.Replace(system, "file:///", "")
' Get the assembly information and display to the console.
Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName(system)
Console.WriteLine(ControlChars.Cr + "Displaying the assembly information of 'System.dll'" + ControlChars.Cr)
Console.WriteLine(myAssemblyName.ToString())
End Sub 'Main
End Class 'AssemblyName_GetAssemblyName
[C#]
using System;
using System.Reflection;
using System.Text.RegularExpressions;
public class AssemblyName_GetAssemblyName
{
public static void Main()
{
// Get the type of 'System.Object'.
Type myType = typeof(System.Object);
// Get the path of 'System.dll'.
string system = Regex.Replace(myType.Assembly.CodeBase, "mscorlib.dll", "System.dll");
system = Regex.Replace(system, "file:///", "");
// Get the assembly information and display to the console.
AssemblyName myAssemblyName = AssemblyName.GetAssemblyName(system);
Console.WriteLine("\nDisplaying the assembly information of 'System.dll'\n");
Console.WriteLine(myAssemblyName.ToString());
}
}
[C++]
#using <mscorlib.dll>
#using <system.dll>
using namespace System;
using namespace System::Reflection;
using namespace System::Text::RegularExpressions;
int main()
{
// Get the type of 'System::Object'.
Type* myType = __typeof(System::Object);
// Get the path of 'System.dll'.
String* system = Regex::Replace(myType->Assembly->CodeBase, S"mscorlib.dll", S"System.dll");
system = Regex::Replace(system, S"file:///", S"");
// Get the assembly information and display to the console.
AssemblyName* myAssemblyName = AssemblyName::GetAssemblyName(system);
Console::WriteLine(S"\nDisplaying the assembly information of 'System.dll'\n");
Console::WriteLine(myAssemblyName);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
AssemblyName クラス | AssemblyName メンバ | System.Reflection 名前空間