static void Main(string[] args) { MyDelg d = new MyDelg(Sum); //int c = d(5, 6), z = d.Invoke(5, 6); //Console.WriteLine("c = " + c + ", z = " + z); //int y = Cal(2, 4, d), x = Cal(2, 4, Sum); //Console.WriteLine("y = " + y + ", x = " + x); d += new MyDelg(Sub); d += new MyDelg(Sub); d -= new MyDelg(Sub); d(5, 7); Cal(5, 7, d); Console.ReadLine(); }
public DelegateTimer(MyDelg myDelg, float time, int callCount) { this.invokeTime = time; this.callCount = callCount; this.delegateToInvoke = myDelg; }
static void Cal(int a, int b, MyDelg x) { x(a, b); }
public void AddDelegateTimer(MyDelg myDelg, float time, int callCount) { DelegateTimer timer = new DelegateTimer(myDelg, time + Time.time, callCount); timers.Add(timer); }