- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 241字
- 2021-07-03 00:11:55
Getting ready
Start off by creating a new WinForms application and performing the following steps:
- Add a button, label, timer, and textbox to the Windows form.

- We need to add the System.Threading.Tasks.Extensions package from NuGet to implement the ValueTask<T> struct. This process should be familiar to you if you completed the Tuples recipe. Select the winform project and click on the Install button.
Note that I am using Visual Studio 2017 RC while writing this book. You probably will not need to add System.Threading.Tasks.Extensions from NuGet in the final release.

- A confirmation screen will be displayed to allow you to review the changes that are about to be made. Just click on OK. Accept the license agreement. Also make sure that you have added this using statement to your project.
using System.Threading.Tasks;
We are now ready to write our code. The Windows app will call an async Task<T> method if the time to live has passed. Once it does that, the method will read a value and cache it. This cached value will be valid for 10 seconds (which is the time to live). If the method is run within the time to live period, then the cached value will be used and returned to the form. If the time to live has passed, the process repeats and the Task<T> method is called. The implementation will become clearer when you review the following code samples.
- Kali Linux Web Penetration Testing Cookbook
- AWS Serverless架構(gòu):使用AWS從傳統(tǒng)部署方式向Serverless架構(gòu)遷移
- Kotlin Standard Library Cookbook
- 用Flutter極速構(gòu)建原生應(yīng)用
- Linux命令行與shell腳本編程大全(第4版)
- 常用工具軟件立體化教程(微課版)
- Learning AngularJS for .NET Developers
- 輕松上手2D游戲開(kāi)發(fā):Unity入門
- Azure Serverless Computing Cookbook
- 零基礎(chǔ)學(xué)HTML+CSS
- PyQt編程快速上手
- C語(yǔ)言程序設(shè)計(jì)
- Java核心技術(shù)速學(xué)版(第3版)
- 基于Docker的Redis入門與實(shí)戰(zhàn)
- TensorFlow程序設(shè)計(jì)