Home > Net > C # to entrust to create the Action instance and does not create difference method is called a deleg
C # to entrust to create the Action instance and does not create difference method is called a deleg
Time:11-19
using System; using System.Collections.Generic; using System.Linq;
The namespace PropertySample { Class Program { The static void Main (string [] args) { The Calculator Calculator=new Calculator (); The Action action1=calculator. The Report;// The Action action2=new Action (calculator. Report);// Action1 (); Action2 (); } }
The class Calculator { Public void Report () { Console. WriteLine (" I have 3 methods. "); } } }
Consult program in picture slash the two sentences can achieve the same effect of entrust, but what is the difference between the two words? Thank you
CodePudding user response:
There is no difference, the junction post (of immiscible points, there is no difference, indeed)
CodePudding user response:
No difference with the first line, the second is written before the Action