TAP is the recommended asynchronous design pattern for new development.

arbitrary 任意的;武断的;专制的

Naming,Parameters,adn Return Types

TAP uses a single method to represent the initiation and completion of an asynchronous operation. 

End methods,

EventArg-derived types. 

initiation启蒙,传授;开始;入会

in contrast to相比之下,与……形成对照

suffix后缀;下标

GetAsync for a get operation.

GetTaskAsync.

 

TResult.

The parameters of a TAP method should match the parameters of its synchronous counterpart, and should be provided in the same order.    

counterpart副本;配对物;极相似的人或物

ref parameters are exempt from this rule and should be avoided entirely.

exempt 被免除的;被豁免的

Task<TResult>, and should use a tuple or a custom data structure to accommodate multiple values.

accommodate 容纳;使适应;供应;调解

Consuming the Task-based Asynchronous Pattern.

devoted致力于

exclusively唯一地;专有地;排外地

manipulation操纵;操作;处理;篡改

intent意图;目的;含义

combinator配合(操纵)器;水力透平机

Asynchronous Programming Patterns.

legacy遗赠,遗产

 

Initiating an Asynchronous Operation

Reasons for a quick return include the following:

  • Asynchronous methods may be invoked from user interface (UI) threads, and any long-running synchronous work could harm the responsiveness of the application.

  • Therefore, any long-running work in the synchronous portion of an asynchronous method could delay the initiation of other asynchronous operations, thereby decreasing the benefits of concurrency.

In such cases, the operation may complete synchronously, and may return a task that has already been completed.

a small amount of少量的

validating 验证(validate的ing形式);确认

initiate开始,创始;发起;使初步了解

responsiveness 响应能力;有同情心

thereby从而,因此;在那附近;在那方面

decrease 减少,减小

 

Exceptions

WhenAll), multiple exceptions may be associated with a single task.

 

Target Environment

When you implement a TAP method, you can determine where asynchronous execution occurs. You may choose to execute the workload on the thread pool, implement it by using asynchronous I/O (without being bound to a thread for the majority of the operation’s execution), run it on a specific thread (such as the UI thread), or use any number of potential contexts.

workload工作量

bound to束缚于

majority 多数;成年

potential潜在的;可能的;势的

AwaitValue in F#).

elsewhere在别处;到别处

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-07-28
  • 2021-04-07
  • 2021-09-28
  • 2022-12-23
  • 2021-10-21
猜你喜欢
  • 2021-08-05
  • 2021-06-20
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案