TplExtensions.NoThrowAwaitable Method
Returns an awaitable for the specified task that will never throw, even if the source task faults or is canceled.
Namespace: Microsoft.VisualStudio.Threading
Assembly: Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function NoThrowAwaitable ( _
task As Task, _
captureContext As Boolean _
) As TplExtensions.NoThrowTaskAwaitable
public static TplExtensions.NoThrowTaskAwaitable NoThrowAwaitable(
this Task task,
bool captureContext
)
[ExtensionAttribute]
public:
static TplExtensions::NoThrowTaskAwaitable NoThrowAwaitable(
Task^ task,
bool captureContext
)
static member NoThrowAwaitable :
task:Task *
captureContext:bool -> TplExtensions.NoThrowTaskAwaitable
public static function NoThrowAwaitable(
task : Task,
captureContext : boolean
) : TplExtensions.NoThrowTaskAwaitable
Parameters
task
Type: System.Threading.Tasks.TaskThe task.
- captureContext
Type: System.Boolean
Return Value
Type: Microsoft.VisualStudio.Threading.TplExtensions.NoThrowTaskAwaitable
Returns TplExtensions.NoThrowTaskAwaitable.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Task. 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).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.