예제 #1
0
        static void Main()
        {
            //BaseTest bt = new BaseTest();
            //bt.ObjTypeTest();
            Stopwatch watch = new Stopwatch();

            watch.Start();

            Publisher  pb = new Publisher();
            Subscriber sb = new Subscriber();

            pb.NumberChanged += sb.OnNumChanged;
            pb.DoSomething();

            NumCount nc  = delegate(int x){ Console.WriteLine("x is {0} ", x); return(0); };
            NumCount nc1 = x => { Console.WriteLine("x1 is {0} ", x); return(0); };
            NumCount nc2 = x => x * x;

            nc(5);
            nc1(10);
            Console.WriteLine("nc2 result is {0}", nc2(20));

            formatNumericalValue(9999);

            DaysOfTheWeek days = new DaysOfTheWeek();

            foreach (string day in days)
            {
                Console.Write(day + " ");
            }
            Console.Write("\n\r");
            watch.Stop();
            Console.WriteLine("watch time is " + watch.ElapsedMilliseconds);
        }
예제 #2
0
 private void WriteSomething(int second)
 {
     for (var i = 0; i < 2; i++)
     {
         Thread.Sleep(second * 500);
         NumCount.Add(i.ToString(CultureInfo.InvariantCulture));
         Thread.Sleep(second * 500);
     }
 }