C# Lazy 简介
暂时没时间写注释,之后会补上(∩_∩)~
上代码,Run一下啦~
/// <summary>
/// 程序入口
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
//不使用延迟加载例子
Stopwatch win7Stopwatch = Stopwatch.StartNew();
win7Stopwatch.Start();
Windows7 win7 = new Windows7(1);
win7Stopwatch.Stop();
Console.WriteLine($"Windows7 before get value waste time:[{win7Stopwatch.Elapsed}]");
//使用延迟加载例子
Stopwatch win10Stopwatch = Stopwatch.StartNew();
win10Stopwatch.Start();
Windows10 windows10 = new Windows10(1);
win10Stopwatch.Stop();
Console.WriteLine($"Windows10.SoftWares is initialized or not:[{windows10.SoftWares.IsValueCreated}]");
Conso