- Introduced in
.Net 4.5
- The method signature includes an
async
modifier. - The name of an
async
method, by convention, ends with anAsync
suffix. - The return type is one of the following types:
Task<TResult>
if your method has a return statement in which the operand has typeTResult
.Task
if your method has no return statement or has a return statement with no operand.void
if you're writing anasync
event handler. This return type is used primarily to define event handlers, where a void return type is required.
- The method usually includes at least one
await
expression, which marks a point where the method can't continue until the awaited asynchronous operation is complete. In the meantime, the method is suspended, and control returns to the method's caller. - When the
async
method eventually completes its work, the task is marked as completed and the result, if any, is stored in the task. - The
async
andawait
keywords don't cause additional threads to be created. Async methods don't require multithreading because anasync
method doesn't run on its own thread. The method runs on the current synchronization context and uses time on the thread only when the method is active. - The marked
async
method can useawait
to designate suspension points. Theawait
operator tells the compiler that theasync
method can't continue past that point until the awaited asynchronous process is complete. In the meantime, control returns to the caller of theasync
method. - The suspension of an
async
method at anawait
expression doesn't constitute an exit from the method, and finally blocks don’t run. - An
async
method typically contains one or more occurrences of anawait
operator, but the absence ofawait
expressions doesn’t cause a compiler error. If anasync
method doesn’t use anawait
operator to mark a suspension point, the method executes as a synchronous method does, despite theasync
modifier. The compiler issues a warning for such methods. - An
async
method that has a void return type can’t be awaited, and the caller of a void-returning method can't catch any exceptions that the method throws. - An
async
method can't declareref
orout
parameters, but the method can call methods that have such parameters.
Source: https://msdn.microsoft.com/en-us/library/mt674882.aspx
Hello everyone, you'll be pleased to know that I stumbled on a page today that explains why lawyers are being barred from attorney suspended from practice I have received entire information about it. And now I'd like to share that information with all of you. I hope you enjoyed reading this information