Action 委托创建委托实例和不创建委托实例调用方法的区别
程序代码:
using System; using System.Collections.Generic; using System.Linq; namespace PropertySample { class Program { static void Main(string[] args) { Calculator calculator = new Calculator(); Action action1 = calculator.Report; // Action action2 = new Action(calculator.Report); // action1(); action2(); } } class Calculator { public void Report() { Console.WriteLine("I have 3 methods."); } } }
请教一下 程序中画下划线的两句程序都可以实现一样的委托效果,但是这两句有什么区别?感谢