c#中怎样声明函数数组

来源:互联网 发布:中南大学教务网络教育 编辑:程序博客网 时间:2024/06/07 09:19
class AppMain
{
   static double add(double a,double b){return a+b;}
   static double sub(double a,double b){return a-b;}
   static double mul(double a,double b){return a*b;}
   static double div(double a,double b){return a/b;}
   delegate double FUNC(double a, double b);

   static void Main()
   {
      FUNC[] f = {
      new FUNC(add),
      new FUNC(sub),
      new FUNC(mul),
      new FUNC(div)
      };
      Console.WriteLine("{0}", f[0](10, 10));
   }

}


http://bbs.csdn.net/topics/40205276

0 0
原创粉丝点击