Forked from pageaffairs/gist:96f5eee016e37cad0920faf4fbd94882
Created
February 4, 2021 07:49
-
-
Save SitePointEditors/1519febd8c011a96d6dc23c9f4f53984 to your computer and use it in GitHub Desktop.
ASP.NET application snippet: 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<ResultType> DoWorkAsync() | |
{ | |
ResultType retVal; | |
try { | |
Task<APIResult> apiResultTask = CallAnAPIAsync(); | |
var fileName = CreateFileName(); | |
var apiResult = await apiResultTask; | |
await WriteToAFileAsync(fileName, apiResult); | |
retVal = await StartAsyncOperation(fileName); | |
} catch (RealException rex) { | |
HandleError(rex); | |
retVal = null | |
} | |
return retVal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment