예제 #1
0
파일: Program.cs 프로젝트: fess9999/csharp
        static void Main(string[] args)
        {
            var report           = new ComplexReport("42");
            var anotherReport    = new AnotherComplexReport();
            var eventBasedReport = new EventBasedReport();

            //Console.WriteLine("Let's build a report. Press any key to begin");
            //Console.ReadKey();

            //SyncReport(report);
            //AsyncReport(report);
            //MulticastReport(report);
            //ActionReport(report);
            //FuncReport(report);
            //AnotherReportProblem(anotherReport);
            //EventReport(eventBasedReport);
            //AnonymousEventReport(eventBasedReport);
            //LambdaEventReport(eventBasedReport);

            ProcessFun();
            //ThreadsFun();
            //RaceCondition1();
            //RaceCondition2();

            //CancelableReport(report);
            //SeveralReportsSimultaneously();
            //AsyncAwaitReport(report).Wait();

            while (true)
            {
                Console.WriteLine($"Echo: {Console.ReadLine()}");
                tokenSource.Cancel();
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: fess9999/csharp
        private static void LambdaEventReport(EventBasedReport eventBasedReport)
        {
            eventBasedReport.OnReportBuilt += result => Console.WriteLine($"Lambda report result: {result}");
            eventBasedReport.OnReportBuilt += PrintReportResult;
            eventBasedReport.OnReportBuilt += SendReportResult;

            eventBasedReport.StartBuilding();
        }
예제 #3
0
파일: Program.cs 프로젝트: fess9999/csharp
        private static void EventReport(EventBasedReport eventBasedReport)
        {
            eventBasedReport.OnReportBuilt += PrintReportResult;
            eventBasedReport.OnReportBuilt += SendReportResult;
            eventBasedReport.StartBuilding();

            //eventBasedReport.OnReportBuilt -= SendReportResult;
        }
예제 #4
0
파일: Program.cs 프로젝트: fess9999/csharp
        private static void AnonymousEventReport(EventBasedReport eventBasedReport)
        {
            eventBasedReport.OnReportBuilt += delegate(string result)
            {
                Console.WriteLine($"Anonymous report result: {result}");
            };
            eventBasedReport.OnReportBuilt += PrintReportResult;
            eventBasedReport.OnReportBuilt += SendReportResult;

            eventBasedReport.StartBuilding();
        }