METHOD
Task.FromException<T>
Creates a faulted task for a specified exception.
Formal Syntax & Structure
csharp syntaxcsharp
Task.FromException<T>(exception)Working Example
Example Snippetcsharp
// Documentary fragment; see lesson for context and imports.Task<int> task = Task.FromException<int>(new InvalidOperationException());