コード例 #1
0
 public void update(NumberGenerator generator)
 {
     Console.WriteLine($"DigitObserver: {generator.getNumber()}");
     try
     {
         Thread.Sleep(100);
     }
     catch (ThreadInterruptedException)
     {
     }
 }
コード例 #2
0
        public void update(NumberGenerator generator)
        {
            Console.Write("GraphObserver:");
            int count = generator.getNumber();

            for (int i = 0; i < count; i++)
            {
                Console.Write("*");
            }
            Console.WriteLine("");
            try
            {
                Thread.Sleep(100);
            }
            catch (ThreadInterruptedException)
            {
            }
        }