1
我有兩種方法申報如何明確定義匿名方法符合哪個簽名?
public void MethodA(object o, Action<string> action) { }
public void MethodA(object o, Action<CustomType> action) { }
我如何調用使用匿名方法,這些功能呢?我知道我可以傳遞一個指向方法的指針,但是我有興趣使用匿名方法來做這件事嗎?目前,我得到錯誤「之間雄心勃勃隨叫隨到.....」
MethodA(this, c => { }); // how to explicitly say that C is of type CustomType?