public delegate void ExecuteCallback();
class Executioner private ExecuteCallback _doExecute;什麼是+ =符號稱爲添加多個委託給委託對象?
public void AddMultiple()
{
// Add a delegate to MethodA
// This will work even if _doExecute is currently null
_doExecute += new Execute(MethodA);
// Add a delegate to MethodB also
_doExecute += new Execute(MethodB);
// Add a delegate to MethodC also
_doExecute += new Execute(MethodC);
}
public void MethodA()
{
//...
}
public void MethodB()
{
//...
}
public void MethodC()
{
//...
}
}
究竟什麼是你的問題? – thecoop 2010-08-19 10:22:21