對不起,要求全部,但我是一個老手Vb.net傢伙誰轉移到C#。我有下面這段代碼,當(在這種情況下)postAsync方法被激發時似乎激活。我只是不;噸瞭解代碼的作用(如下): -什麼是+ =(o,arg)=>實際實現?
app.PostCompleted +=
(o, args) =>
{
if (args.Error == null)
{
MessageBox.Show("Picture posted to wall successfully.");
}
else
{
MessageBox.Show(args.Error.Message);
}
};
如果有人能說明什麼+ =(O,參數)=>實際上acheiving我會如此感激.. ..
非常感謝提前。 Tim
這就是'app.PostCompleted + = new EventHandler(YourHandler)'的簡寫本身;'。 – Shibumi
你甚至不需要有「新的EventHandler」。 C#編譯器足夠聰明,可以推斷出使用哪個委託。所以更短的快捷方式是'app.PostCompleted + = YourHandler;' – Sung
@Sung我想這正是他所說的。 –