LAZY Constructor in C#

In General,

New program

Now we can restrict it, with LAZY keyword.

  1. Lazy<Program> pro = new Lazy<Program>();  
Lazy

Finally Implementation.
  1. try  
  2. {  
  3.     Program prgm = new Program();  
  4.     prgm.Sample();  
  5.     Lazy < Program > pro = new Lazy < Program > ();  
  6.     var Getvalue = pro.Value;  
  7.     Console.Read();  
  8. }  
  9. catch (Exception ex)  
  10. {  
  11.     Console.WriteLine(ex.Message.ToString());  
  12.     Console.Read();  
  13. }  
code

Ebook Download
View all
Learn
View all