ResolveEventHandler 委托

定义

表示处理 TypeResolveResourceResolveAssemblyResolveAppDomain 事件的方法。Represents a method that handles the TypeResolve, ResourceResolve, or AssemblyResolve event of an AppDomain.

public delegate System::Reflection::Assembly ^ ResolveEventHandler(System::Object ^ sender, ResolveEventArgs ^ args);
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public delegate System.Reflection.Assembly ResolveEventHandler(object sender, ResolveEventArgs args);
type ResolveEventHandler = delegate of obj * ResolveEventArgs -> Assembly
Public Delegate Function ResolveEventHandler(sender As Object, args As ResolveEventArgs) As Assembly 

参数

sender
Object

事件源。The source of the event.

args
ResolveEventArgs

事件数据。The event data.

返回值

Assembly

解析类型、程序集或资源的程序集;如果无法解析程序集,则为 nullThe assembly that resolves the type, assembly, or resource; or null if the assembly cannot be resolved.

继承
ResolveEventHandler
属性

注解

如果运行时类加载程序无法解析对程序集、类型或资源的引用,则会引发相应的事件,使回调有机会通知运行时引用的程序集、类型或资源在中的程序集。If the runtime class loader cannot resolve a reference to an assembly, type, or resource, the corresponding events are raised to give the callback a chance to tell the runtime which assembly the referenced assembly, type, or resource is in. ResolveEventHandler需要返回解析类型、程序集或资源的程序集,如果不能识别程序集,则返回 null。It is the responsibility of the ResolveEventHandler to return the assembly that resolves the type, assembly, or resource, or to return null if the assembly is not recognized. 有关详细信息,请参阅解析程序集加载 AppDomain.ResourceResolveAppDomain.AssemblyResolve、和AppDomain.ReflectionOnlyAssemblyResolve事件。For more information, see Resolving Assembly Loads and the AppDomain.ResourceResolve, AppDomain.AssemblyResolve, and AppDomain.ReflectionOnlyAssemblyResolve events.

重要

从开始.NET Framework 4.NET Framework 4 System.ResolveEventHandler ,为所有程序集(包括资源程序集)引发事件。Beginning with the .NET Framework 4.NET Framework 4, the System.ResolveEventHandler event is raised for all assemblies, including resource assemblies. 在早期版本中,资源程序集不引发事件。In earlier versions, the event was not raised for resource assemblies. 如果对操作系统进行了本地化,则可以多次调用处理程序:对回退链中的每个区域性调用一次。If the operating system is localized, the handler might be called multiple times: once for each culture in the fallback chain.

InvokeDelegate 的每个派生类都有一个构造函数和一个方法。MulticastDelegateEvery derived class of Delegate and MulticastDelegate has a constructor and an Invoke method. 请参阅C++ Delegate类的说明中的代码示例。See the C++ code example in the description for the Delegate class.

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

适用于

另请参阅