コード例 #1
0
        public void Send()
        {
            FooProcessor          processor = new FooProcessor();
            IEnumerable <FooItem> foos      = processor.ProcessFoos();
            var logger = new ConsoleLogger();

            foreach (var foo in foos)
            {
                //Sending has a logging side effect
                logger.Log("Started sending a foo...");

                //Sending is expensive
                //zoom zoom the foos go over the wire somewhere
                Thread.Sleep(10000);

                //Sending has another logging side effect
                logger.Log("Sent a foo.");
            }
        }
コード例 #2
0
ファイル: FooSender.cs プロジェクト: sphavens/disample
        public void Send()
        {
            FooProcessor processor = new FooProcessor();
            IEnumerable<FooItem> foos = processor.ProcessFoos();
            var logger = new ConsoleLogger();

            foreach (var foo in foos)
            {
                //Sending has a logging side effect
                logger.Log("Started sending a foo...");

                //Sending is expensive
                //zoom zoom the foos go over the wire somewhere
                Thread.Sleep(10000);

                //Sending has another logging side effect
                logger.Log("Sent a foo.");
            }
        }