using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        delegate void D1(string name);
        static Action<string> A1;
        static  Func<string,string> F1;
        

        static void Main(string[] args)
        {
            D1 d1 = new D1(HelloWorld);
            d1("aa");



            D1 d2 = delegate(string name)
            {
                Console.WriteLine("Hello,{0}!", name);
            };
            d2("aaa");


            A1 = new Action<string>(HelloWorld);
            A1("a3");

            F1 = new Func<string,string>(HelloWorld2);
            Console.WriteLine(F1("aaaa"));

            Console.ReadKey();

            
        }

        static void HelloWorld(string name)
        {
            Console.WriteLine("Hello ,{0}!", name);
        }

        static string HelloWorld2(string name)
        {
            return name;
        }
    }

}

 

相关文章:

  • 2021-09-20
  • 2022-12-23
  • 2022-02-15
  • 2021-09-27
  • 2019-09-14
猜你喜欢
  • 2021-06-06
  • 2021-08-13
  • 2021-06-30
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案