Пример #1
0
 public ScopeTestHandler(OnlyOne only1, OnlyOne only2, PerTransaction per1, PerTransaction per2, AlwaysNew new1, AlwaysNew new2)
 {
     Only1 = only1;
     Only2 = only2;
     Per1  = per1;
     Per2  = per2;
     New1  = new1;
     New2  = new2;
 }
         static void Main(string[] args)
         {
             OnlyOne.SetMyName("I m the only one."); //static constructor will be called first time when the class will be referenced.
             Console.WriteLine(OnlyOne.GetMyName());
 
             NoInstance.SetMyName("I have private constructor"); //No constructor will be called when the class will be referenced.
             Console.WriteLine(NoInstance.GetMyName());
 
             Console.Read();
         }