コード例 #1
0
        static void Main(string[] args)
        {
            // A delegate is a type safe function pointer

            HelloFuntionDelegate hd = new HelloFuntionDelegate(Hello);

            hd("Hello from delegate");


            List <Employee> empList = new List <Employee>();

            empList.Add(new Employee()
            {
                ID = 101, Name = "John", Salary = 5000, Experience = 5
            });
            empList.Add(new Employee()
            {
                ID = 102, Name = "Mary", Salary = 4000, Experience = 4
            });
            empList.Add(new Employee()
            {
                ID = 103, Name = "Sam", Salary = 3000, Experience = 3
            });
            empList.Add(new Employee()
            {
                ID = 104, Name = "Edward", Salary = 6000, Experience = 6
            });
            Employee.PromoteEmployee(empList);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            HelloFuntionDelegate helloFuntionDelegate = new HelloFuntionDelegate(Hello);

            helloFuntionDelegate("Hello From Deltegate");

            //Delegate is a type safe function pointer
            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            HelloFuntionDelegate del = new HelloFuntionDelegate(Hello);//proslijediti ime metode koja mora biti void

            del("Hello from Delegate");
        }