In General,
Now we can restrict it, with LAZY keyword.
- Lazy<Program> pro = new Lazy<Program>();
Finally Implementation.
- try
- {
- Program prgm = new Program();
- prgm.Sample();
- Lazy < Program > pro = new Lazy < Program > ();
- var Getvalue = pro.Value;
- Console.Read();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message.ToString());
- Console.Read();
- }