AssemblyName Constructor (String^)
Initializes a new instance of the AssemblyName class with the specified display name.
Assembly: mscorlib (in mscorlib.dll)
| Exception | Condition | ||
|---|---|---|---|
| ArgumentNullException | assemblyName is null. | ||
| ArgumentException | assemblyName is a zero length string. | ||
| FileLoadException |
The referenced assembly could not be found, or could not be loaded. |
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 example creates an instance of AssemblyName from a display name. The individual elements of the display name are output to the console as properties of the AssemblyNameobject.
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 */
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
