JavaScriptExtensions.ToPromise<T>(Task<T>) Method |
Converts a
Task<TResult> instance to a
promise
for use with script code currently running on the calling thread.
Namespace: Microsoft.ClearScript.JavaScriptAssembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntaxpublic static Object ToPromise<T>(
this Task<T> task
)
<ExtensionAttribute>
Public Shared Function ToPromise(Of T) (
task As Task(Of T)
) As Object
public:
[ExtensionAttribute]
generic<typename T>
static Object^ ToPromise(
Task<T>^ task
)
[<ExtensionAttribute>]
static member ToPromise :
task : Task<'T> -> Object
Parameters
- task Task<T>
- The task to convert to a promise.
Type Parameters
- T
- The task's result type.
Return Value
ObjectA promise that represents the task's asynchronous operation.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Task<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also