原文:
Use delegate inference instead of explicit delegate instantiation
delegate void SomeDelegate();
public void SomeMethod()
{}
SomeDelegate someDelegate = SomeMethod;
我的问题是什么是delegate inference?什么是explicit delegate instantiation ?前者有什么好处?后者有什么问题?
Use delegate inference instead of explicit delegate instantiation
delegate void SomeDelegate();
public void SomeMethod()
{}
SomeDelegate someDelegate = SomeMethod;
我的问题是什么是delegate inference?什么是explicit delegate instantiation ?前者有什么好处?后者有什么问题?
explicit delegate instantiation就是直接对代理初始化。
使用前者更灵活。
public void SomeMethod(){} //
SomeDelegate someDelegate = SomeMethod;//someDelegate is a instance of delegate interface SomeDelegate, that is "explicit delegate instantiation"