Partager via


Assembly.Load Method (String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Loads an assembly given the long form of its name.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Shared Function Load ( _
    assemblyString As String _
) As Assembly
[SecuritySafeCriticalAttribute]
public static Assembly Load(
    string assemblyString
)

Parameters

  • assemblyString
    Type: System.String
    The long form of the assembly name.

Return Value

Type: System.Reflection.Assembly
The loaded assembly.

Exceptions

Exception Condition
ArgumentNullException

assemblyString is nulla null reference (Nothing in Visual Basic).

ArgumentException

assemblyString is a zero-length string.

FileNotFoundException

assemblyString is not found.

FileLoadException

A file that was found could not be loaded.

BadImageFormatException

assemblyString is not a valid assembly.

-or-

assemblyString was compiled for a later version of the common language runtime than the currently executing version.

Remarks

FileLoadException is thrown if assemblyString specifies the full assembly name, and the first assembly that matches the simple name has a different version, culture, or public key token. The loader does not continue probing for other assemblies that match the simple name.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

  If you pass an invalid string to the Load method, it throws an IOException exception instead of an ArgumentException exception.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.