Namespace:
System
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Function Load ( _
assemblyRef As AssemblyName _
) As Assembly
Dim instance As AppDomain
Dim assemblyRef As AssemblyName
Dim returnValue As [Assembly]
returnValue = instance.Load(assemblyRef)
public Assembly Load(
AssemblyName assemblyRef
)
public:
virtual Assembly^ Load(
AssemblyName^ assemblyRef
) sealed
public final function Load(
assemblyRef : AssemblyName
) : Assembly
Implements
_AppDomain..::.Load(AssemblyName)
This method should only be used to load an assembly into the current application domain. This method is defined for interoperability callers who cannot call the static Load method.
If a version of the requested assembly is already loaded, this method returns the loaded assembly, even if a different version is requested.
Supplying a partial assembly name for assemblyRef is not recommended. (A partial name omits one or more of culture, version, or public key token. For overloads that take a string instead of an AssemblyName object, "MyAssembly, Version=1.0.0.0" is an example of a partial name and "MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=18ab3442da84b47" is an example of a full name.) Using partial names has a negative effect on performance. In addition, a partial assembly name can load an assembly from the global assembly cache only if there is an exact copy of the assembly in the application base directory (BaseDirectory or AppDomainSetup..::.ApplicationBase).
If the current AppDomain object represents application domain A, and the Load method is called from application domain B, the assembly is loaded into both application domains. For example, the following code loads MyAssembly into the new application domain ChildDomain and also into the application domain where the code executes:
Dim ad As AppDomain = AppDomain.CreateDomain("ChildDomain")
ad.Load("MyAssembly")
AppDomain ad = AppDomain.CreateDomain("ChildDomain");
ad.Load("MyAssembly");
AppDomain^ ad = AppDomain::CreateDomain("ChildDomain");
ad->Load("MyAssembly");
The assembly is loaded into both domains because Assembly does not derive from MarshalByRefObject, and therefore the return value of the Load method cannot be marshaled. Instead, the common language runtime tries to load the assembly into the calling application domain. The assemblies that are loaded into the two application domains might be different if the path settings for the two application domains are different.
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, 1.1, 1.0
Reference