コード例 #1
0
        static void Main(string[] args)
        {
            Log log = new Log();

            LogDel LogTextToScreenDel, LogTextToFileDel;

            LogTextToScreenDel = new LogDel(log.LogTextToScreen);

            LogTextToFileDel = new LogDel(log.LogTextToFile);

            LogDel multiLogDel = LogTextToScreenDel + LogTextToFileDel;

            Console.WriteLine("Please enter your name");

            var name = Console.ReadLine();

            LogText(multiLogDel, name);

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: rettetdemdativ/POS_HTBLA
        public static void Main(string[] args)
        {
            string ant = string.Empty, ant1;

            /*
             * set LogDel to null for now
             */
            LogDel l = null;

            do
            {
                Console.Clear();

                Console.Write("Wollen Sie loggen? (j/n) ");
                ant1 = Console.ReadLine();

                switch (ant1.ToLower())
                {
                case "j":
                    /*
                     * calls the method Logger.log(); with the delegate
                     * and prints the returned string
                     */
                    l = Logger.log;
                    Console.WriteLine(l("Hier ist Ihr Log."));
                    break;

                case "n":
                    l = null;
                    break;
                }

                Console.Write("Wollen Sie das Programm neu starten? (j/n) ");
                ant = Console.ReadLine();
            } while(ant.ToLower().StartsWith("j"));
        }
コード例 #3
0
 static void LogText(LogDel logDel, string text)
 {
     logDel(text);
 }