T
Cocktail Help Reference
OnComplete<T>(Task<T>,Action<T>,Action<Exception>) Method
See Also  Send Feedback
Cocktail.Compat Assembly > Cocktail Namespace > TaskExtensions Class > OnComplete Method : OnComplete<T>(Task<T>,Action<T>,Action<Exception>) Method



task
The task representing the asynchronous operation.
onSuccess
A callback to be called if the task completed was successful.
onFail
A callback to be called if the task failed.

Glossary Item Box

Extension method to process the result of an asynchronous query operation.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Function OnComplete(Of T)( _
   ByVal task As Task(Of T), _
   ByVal onSuccess As Action(Of T), _
   ByVal onFail As Action(Of Exception) _
) As OperationResult(Of T)
Visual Basic (Usage)Copy Code
Dim task As Task(Of T)
Dim onSuccess As Action(Of T)
Dim onFail As Action(Of Exception)
Dim value As OperationResult(Of T)
 
value = TaskExtensions.OnComplete(Of T)(task, onSuccess, onFail)
C# 
[ExtensionAttribute()]
public static OperationResult<T> OnComplete<T>( 
   Task<T> task,
   Action<T> onSuccess,
   Action<Exception> onFail
)
C++/CLI 
[ExtensionAttribute()]
public:
static OperationResult<T^>^ OnCompletegeneric<typename T>
( 
   Task<T^>^ task,
   Action<T^>^ onSuccess,
   Action<Exception^>^ onFail
) 

Parameters

task
The task representing the asynchronous operation.
onSuccess
A callback to be called if the task completed was successful.
onFail
A callback to be called if the task failed.

Type Parameters

T

Return Value

OperationResult encapsulating the provided System.Threading.Tasks.Task.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.