C#委托 抛瓦羊 2023-01-29 38 阅读1分钟 使用 //定义委托 delegate void OtherFun(int x); //将符合该委托的方法委托给它 public static Add(int x) { Console.WriteLine(x); } //委托 //1. OtherFun otherFun = null; otherFun = Add; otherFun(); //2. OtherFun otherFun = new OtherFun(Add); otherFun();