Initializes a new instance of the AssemblyName class with the specified display name.
Namespace:
System.Reflection
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Sub New ( _
assemblyName As String _
)
Dim assemblyName As String
Dim instance As New AssemblyName(assemblyName)
public AssemblyName(
string assemblyName
)
public:
AssemblyName(
String^ assemblyName
)
public function AssemblyName(
assemblyName : String
)
The supplied assemblyName is parsed, and the appropriate fields of the new AssemblyName are initialized with values from the display name. This is the recommended way of parsing display names. Writing your own code to parse display names is not recommended.
The following code example creates a dynamic assembly named MyAssembly.exe and saves it to your hard disk. After running the example, you can use the MSIL Disassembler (Ildasm.exe) to examine the assembly metadata.
Imports System
Imports System.Reflection
Public Class AssemblyNameDemo
Public Shared Sub Main()
' Create an AssemblyName, specifying the display name, and then
' print the properties.
Dim myAssemblyName As New _
AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null")
Console.WriteLine("Name: {0}", myAssemblyName.Name)
Console.WriteLine("Version: {0}", myAssemblyName.Version)
Console.WriteLine("CultureInfo: {0}", myAssemblyName.CultureInfo)
Console.WriteLine("FullName: {0}", myAssemblyName.FullName)
End Sub
End Class
' This code example produces output similar to the following:
'
'Name: Example
'Version: 1.0.0.2001
'CultureInfo: en-US
'FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null
using System;
using System.Reflection;
public class AssemblyNameDemo
{
public static void Main()
{
// Create an AssemblyName, specifying the display name, and then
// print the properties.
AssemblyName myAssemblyName =
new AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null");
Console.WriteLine("Name: {0}", myAssemblyName.Name);
Console.WriteLine("Version: {0}", myAssemblyName.Version);
Console.WriteLine("CultureInfo: {0}", myAssemblyName.CultureInfo);
Console.WriteLine("FullName: {0}", myAssemblyName.FullName);
}
}
/* This code example produces output similar to the following:
Name: Example
Version: 1.0.0.2001
CultureInfo: en-US
FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null
*/
using namespace System;
using namespace System::Reflection;
int main()
{
// Create an AssemblyName, specifying the display name, and then
// print the properties.
AssemblyName^ myAssemblyName =
gcnew AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null");
Console::WriteLine("Name: {0}", myAssemblyName->Name);
Console::WriteLine("Version: {0}", myAssemblyName->Version);
Console::WriteLine("CultureInfo: {0}", myAssemblyName->CultureInfo);
Console::WriteLine("FullName: {0}", myAssemblyName->FullName);
}
/* This code example produces output similar to the following:
Name: Example
Version: 1.0.0.2001
CultureInfo: en-US
FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null
*/
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference