コード例 #1
0
        static void Main(string[] args)
        {
            var service = new ConsoleButton
            {
                Boundary      = "-",
                Width         = 8,
                Height        = 20,
                Text          = "Button",
                InsideColor   = ConsoleColor.Red,
                BoundaryColor = ConsoleColor.Yellow
            };

            service.Button();

            service.ButtonAction += new Action <int>(Console.WriteLine);
            service.ButtonAction += Console.WriteLine;

            service.ButtonAction += data => Console.WriteLine(data);

            int[] integers = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            var result = integers.Where(integer => integer > 5);

            foreach (var value in result)
            {
                Console.Write($"{value} ");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: 4klb/Delegates
        static void Main(string[] args)
        {
            var service = new ConsoleButton
            {
                Boundary      = "-",
                Width         = 8,
                Height        = 20,
                Text          = "Button",
                InsideColor   = ConsoleColor.Red,
                BoundaryColor = ConsoleColor.Yellow,
                Action        = new ActionDelegate(Console.WriteLine)
            };

            service.Button();
            service.Action += new ActionDelegate(Console.WriteLine);
            service.Action -= new ActionDelegate(Console.WriteLine);
        }