AssemblyName.ToString-Methode
Gibt den vollständigen Namen der Assembly zurück, der auch als Anzeigename bezeichnet wird.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Overrides Function ToString As String
'Usage
Dim instance As AssemblyName
Dim returnValue As String
returnValue = instance.ToString
public override string ToString ()
public:
virtual String^ ToString () override
public String ToString ()
public override function ToString () : String
Rückgabewert
Ein String, der den vollständigen Namen oder den Klassennamen der Assembly darstellt, wenn der vollständige Name der Assembly nicht bestimmt werden kann.
Hinweise
Informationen zum Format der zurückgegebenen Zeichenfolge finden Sie in der Beschreibung von AssemblyName.
Beispiel
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Public Class AssemblyName_GetAssemblyName
Public Shared Sub Main()
' Replace the string "MyAssembly.exe" with the name of an assembly,
' including a path if necessary. If you do not have another assembly
' to use, you can use whatever name you give to this assembly.
'
Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName("MyAssembly.exe")
Console.WriteLine(vbCrLf & "Displaying assembly information:" & vbCrLf)
Console.WriteLine(myAssemblyName.ToString())
End Sub 'Main
End Class 'AssemblyName_GetAssemblyName
using System;
using System.Reflection;
public class AssemblyName_GetAssemblyName
{
public static void Main()
{
// Replace the string "MyAssembly.exe" with the name of an assembly,
// including a path if necessary. If you do not have another assembly
// to use, you can use whatever name you give to this assembly.
//
AssemblyName myAssemblyName = AssemblyName.GetAssemblyName("MyAssembly.exe");
Console.WriteLine("\nDisplaying assembly information:\n");
Console.WriteLine(myAssemblyName.ToString());
}
}
#using <system.dll>
using namespace System;
using namespace System::Reflection;
int main()
{
// Replace the string "MyAssembly.exe" with the name of an assembly,
// including a path if necessary. If you do not have another assembly
// to use, you can use whatever name you give to this assembly.
//
AssemblyName^ myAssemblyName = AssemblyName::GetAssemblyName( "MyAssembly.exe" );
Console::WriteLine( "\nDisplaying assembly information:\n" );
Console::WriteLine( myAssemblyName );
}
import System.*;
import System.Reflection.*;
import System.Text.RegularExpressions.*;
public class AssemblyNameGetAssemblyName
{
public static void main(String[] args)
{
// Get the type of 'System.Object'.
Type myType = Object.class.ToType();
// Get the path of 'System.dll'.
String system = Regex.Replace(myType.get_Assembly().get_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());
} //main
} //AssemblyNameGetAssemblyName
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
AssemblyName-Klasse
AssemblyName-Member
System.Reflection-Namespace