1 out of 1 rated this helpful Rate this topic

AssemblyName.ReferenceMatchesDefinition Method

Returns a value indicating whether the loader resolves two assembly names to the same assembly.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)
public static bool ReferenceMatchesDefinition(
	AssemblyName reference,
	AssemblyName definition
)

Parameters

reference
Type: System.Reflection.AssemblyName
The reference assembly name.
definition
Type: System.Reflection.AssemblyName
The assembly name that is compared to the reference assembly.

Return Value

Type: System.Boolean
true if the loader resolves definition to the same assembly as reference; otherwise, false.

Both reference and definition are resolved by the loader, including policy evaluation, and then definition is tested for equality to reference.

The order of comparison is important, because the method tests whether the loader will accept definition to satisfy a load request for reference. Such mappings are not necessarily two-way.

For example, you might compare "MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" with "MyAssembly, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null".

If the handler for the AssemblyResolve event has a reference display name, it can pass the display name of an available assembly as the definition parameter, to see if the available assembly would satisfy the load request. If so, the handler can return the available assembly.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ