Code for caching Task<bool> results.
private static Task<bool> trueTask;
private static Task<bool> falseTask;
public static Task<bool> SiteIsUpAsyncCache(string url)
if (url.Length % 2 == 0)
return trueTask ?? (trueTask = CreateTaskResult(true));
return falseTask ?? (falseTask = CreateTaskResult(false));
private static Task<T> CreateTaskResult<T>(T result)
var tcs = new TaskCompletionSource<T>();
About the Author
Patrick Steele is a senior .NET developer with Billhighway in Troy, Mich. A recognized expert on the Microsoft .NET Framework, he’s a former Microsoft MVP award winner and a presenter at conferences and user group meetings.
With Visual Studio v17.6 becoming generally available recently, Microsoft provided a peek at what's coming up in the next iteration, VS 2022 v17.7
Dev team shows how Welcome revamp was first presented and then how it was shaped by community feedback.
Microsoft's regular monthly update to Java on Visual Studio Code (May 2023) brings new features around performance improvement, the user experience and Spring Boot integration, among many others.
Dr. James McCaffrey of Microsoft Research says the main advantage of using Gaussian naive Bayes classification compared to other techniques like decision trees or neural networks is that you don't have to fine tune model parameters.
> More Webcasts