1. 程式人生 > >C# delegate的新的認識 關於型別轉換

C# delegate的新的認識 關於型別轉換

public class Test{
    public delegate void repeatRecall();     
    public repeatRecall finalCall;  //最終呼叫
    public List<repeatRecall> repeatCallList;

    void Test1(){}
    void Start(){
        finalCall = Test1;
        repeatCallList.Add(repeatCheck);
        }
}

delegate 一個repeatRecall 的委託

然後創造了一個委託 finalCall  和一個委託泛型集合

1、委託是可以使用泛型集合的

2、要給一個委託賦值 直接就是將相同簽名的函式賦值給他就是了。不需要有()。