Exemplo n.º 1
0
 public static OfficeBoy GetObject()
 {
     if (_ref == null)
     {
         _ref = new OfficeBoy();
     }
     return(_ref);
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            OfficeBoy sweeper, waiter;
            string    s1; float f1;

            sweeper     = OfficeBoy.GetObject();
            waiter      = OfficeBoy.GetObject();
            sweeper.Val = 60;
            Console.WriteLine("Sweeper Value : {0}", sweeper.Val);
            Console.WriteLine("Waiter Value : {0}", waiter.Val);
            s1          = sweeper.Val.ToString();
            f1          = (float)sweeper.Val;
            sweeper.Val = int.Parse(s1);
            sweeper.Val = Convert.ToInt32(s1);

            Console.ReadLine();
        }