예제 #1
0
파일: Program.cs 프로젝트: lemmit/RealOOP
 private static async Task UseMixinsToCreateFinalObject(ILogger logger)
 {
     Console.WriteLine("Create object using mixins and call methods");
     var obj = new RealObject();
     obj.Mixin<SquareDrawerObject>();
     obj.Mixin<TreeDrawerObject>();
     var deadletter = new DeadLetterObject(logger);
     await deadletter.Send(obj, new DrawTreeMessage(3));
     await deadletter.Send(obj, new DrawSquareMessage(3));
 }
예제 #2
0
파일: Program.cs 프로젝트: lemmit/RealOOP
 private static async Task ChangeMethodAtRuntime(ILogger logger, DeadLetterObject deadletter)
 {
     Console.WriteLine("Define method at runtime using dynamic object");
     var dynamicObject = new DynamicObject(logger);
     Console.WriteLine("Define method at runtime [1st call - undefined]");
     await deadletter.Send(dynamicObject, new GreetMessage());
     Console.WriteLine("Define method at runtime [2nd call]");
     dynamicObject.AddOrUpdateMethod<GreetMessage>(new Method(async sender => await Task.Run( () => Console.WriteLine("Howdy!"))));
     await deadletter.Send(dynamicObject, new GreetMessage());
     Console.WriteLine();
 }
예제 #3
0
파일: Program.cs 프로젝트: lemmit/RealOOP
        private static async Task UseMixinsToCreateFinalObject(ILogger logger)
        {
            Console.WriteLine("Create object using mixins and call methods");
            var obj = new RealObject();

            obj.Mixin <SquareDrawerObject>();
            obj.Mixin <TreeDrawerObject>();
            var deadletter = new DeadLetterObject(logger);
            await deadletter.Send(obj, new DrawTreeMessage(3));

            await deadletter.Send(obj, new DrawSquareMessage(3));
        }
예제 #4
0
파일: Program.cs 프로젝트: lemmit/RealOOP
        private static async Task ChangeMethodAtRuntime(ILogger logger, DeadLetterObject deadletter)
        {
            Console.WriteLine("Define method at runtime using dynamic object");
            var dynamicObject = new DynamicObject(logger);

            Console.WriteLine("Define method at runtime [1st call - undefined]");
            await deadletter.Send(dynamicObject, new GreetMessage());

            Console.WriteLine("Define method at runtime [2nd call]");
            dynamicObject.AddOrUpdateMethod <GreetMessage>(new Method(async sender => await Task.Run(() => Console.WriteLine("Howdy!"))));
            await deadletter.Send(dynamicObject, new GreetMessage());

            Console.WriteLine();
        }
예제 #5
0
파일: Program.cs 프로젝트: lemmit/RealOOP
 private static async Task Inheritance(ILogger logger, DeadLetterObject deadletter)
 {
     var derived = new GreeterObject(logger);
     Console.WriteLine("Method call message type");
     await deadletter.Send(derived, new GreetMessage());
     Console.WriteLine();
 }
예제 #6
0
파일: Program.cs 프로젝트: lemmit/RealOOP
 private static async Task  InheritanceWithOverridenMethod(ILogger logger, DeadLetterObject deadletter)
 {
     Console.WriteLine("Method overloaded in derived type");
     var politeGreeter = new PoliteGreeterObject(logger);
     await deadletter.Send(politeGreeter, new GreetMessage());
     Console.WriteLine();
 }
예제 #7
0
파일: Program.cs 프로젝트: lemmit/RealOOP
        private static async Task  InheritanceWithOverridenMethod(ILogger logger, DeadLetterObject deadletter)
        {
            Console.WriteLine("Method overloaded in derived type");
            var politeGreeter = new PoliteGreeterObject(logger);
            await deadletter.Send(politeGreeter, new GreetMessage());

            Console.WriteLine();
        }
예제 #8
0
파일: Program.cs 프로젝트: lemmit/RealOOP
        private static async Task Inheritance(ILogger logger, DeadLetterObject deadletter)
        {
            var derived = new GreeterObject(logger);

            Console.WriteLine("Method call message type");
            await deadletter.Send(derived, new GreetMessage());

            Console.WriteLine();
        }