0
如果我有一個方法將委託作爲參數,傳入委託(即指向方法)和傳入方法名稱之間是否有區別?如果是這樣,每種方法的優點/缺點是什麼?C#傳入委託與傳入方法
delegate void MyDel();
static void MyFunc(MyDel)
{
MyDel();
}
static void SomeFunc(){//do stuff}
static void Main()
{
MyDel del= new MyDel(SomeFunc);
//What's the difference between the approaches below?
del();
MyFunc(SomeFunc);
}
的可能的複製[是代表和回調相同或相似的?](https://stackoverflow.com/questions/290819/are-代表和回調 - 相同或相似) – GolezTrol
什麼是*「通過實際方法」*?你能舉兩個例子的代碼嗎? – Sinatr
沒有「傳入實際方法」這樣的東西 - 如果您使用*方法組*作爲參數,它將轉換爲委託。 –