Posts
[C#]LevelUp.Lazy
namespace LazyDemo { class Program { static void Main(string[] args) { var count = 10; LevelUpLazy.Lazy<string>[] lazys = new LevelUpLazy.Lazy<string>[count]; for (int i = 0; i < count; i++) { lazys[i] = new LevelUpLazy.Lazy<string>(DoWork); }
lazys[3].ValueInited += new EventHandler(laz3_ValueInited); lazys[3].BeginInit();
lazys[2].BeginInit();
Stopwatch sw = Stopwatch.StartNew(); Console.WriteLine(“lazy1 result = {0}”, lazys[1].Value); Console.WriteLine(“lazy1 Elapsed Time = {0} ms”, sw.ElapsedMilliseconds);
sw.Restart(); Console.WriteLine(“lazy1 result = {0}”, lazys[1].Value); Console.WriteLine(“lazy1 Elapsed Time = {0} ms”, sw.
read more