EventHandlerTaskAsyncHelper 类
定义
将任务返回的异步方法转换为使用用于 ASP.NET 的前一版本的异步编程模型和基于启动和结束事件的方法。Converts task-returning asynchronous methods into methods that use the asynchronous programming model used in previous versions of ASP.NET and that is based on begin and end events.
public ref class EventHandlerTaskAsyncHelper sealed
public sealed class EventHandlerTaskAsyncHelper
type EventHandlerTaskAsyncHelper = class
Public NotInheritable Class EventHandlerTaskAsyncHelper
- 继承
-
EventHandlerTaskAsyncHelper
注解
若要在 ASP.NET 4.5 中处理异步任务,请实现逻辑以将任务作为 TaskEventHandler 委托返回。To handle asynchronous tasks in ASP.NET 4.5, you implement the logic to return a task as a TaskEventHandler delegate. 此基于任务的异步编程模型取代了早期版本的 ASP.NET 中使用的模型,该模型基于开始和结束事件的所有事件处理。This model of asynchronous task-based programming supersedes the model used in previous versions of ASP.NET, which bases all event handling on begin and end events. 实现 TaskEventHandler 委托后,可以将其传递给 EventHandlerTaskAsyncHelper 构造函数,该构造函数包装任务返回的逻辑,并将处理程序转换为使用 begin 和 end 事件的模型。After you implement a TaskEventHandler delegate, you can then pass it to the EventHandlerTaskAsyncHelper constructor, which wraps the task-returning logic and converts the handler to the model that uses begin and end events. EventHandlerTaskAsyncHelper类使对象与 TaskEventHandler ASP.NET 页框架兼容。The EventHandlerTaskAsyncHelper class enables your TaskEventHandler object to be compatible with the ASP.NET page framework. 当你调用 AddOnPreRenderCompleteAsync 方法来处理异步页的任务时,你可以使用 BeginEventHandler 和 EndEventHandler 属性将转换后的开始和事件处理程序传递给方法。When you call the AddOnPreRenderCompleteAsync method to process the task for an asynchronous page, you can use the BeginEventHandler and EndEventHandler properties to pass the converted begin and event handlers to the method.
构造函数
| EventHandlerTaskAsyncHelper(TaskEventHandler) |
初始化 EventHandlerTaskAsyncHelper 类的新实例。Initializes a new instance of the EventHandlerTaskAsyncHelper class. |
属性
| BeginEventHandler |
表示异步任务的 BeginEventHandler 方法。Represents the BeginEventHandler method for an asynchronous task. |
| EndEventHandler |
表示异步任务的 EndEventHandler 方法。Represents the EndEventHandler method for an asynchronous task. |
方法
| Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
| GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
| GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
| MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
| ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |