Пример #1
0
        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();
        }
Пример #2
0
 public DelegateTimer(MyDelg myDelg, float time, int callCount)
 {
     this.invokeTime       = time;
     this.callCount        = callCount;
     this.delegateToInvoke = myDelg;
 }
Пример #3
0
 static void Cal(int a, int b, MyDelg x)
 {
     x(a, b);
 }
Пример #4
0
    public void AddDelegateTimer(MyDelg myDelg, float time, int callCount)
    {
        DelegateTimer timer = new DelegateTimer(myDelg, time + Time.time, callCount);

        timers.Add(timer);
    }