最近,我問了一個問題在這裏,有人提供了這樣的回答:在這個C#代碼中,我的方法在做什麼符號「=>」?
private void button1_Click(object sender, EventArgs e)
{
var client = new WebClient();
Uri X = new Uri("http://www.google.com");
client.DownloadStringCompleted += (s, args) => //THIS, WHAT IS IT DOING?
{
if (args.Error == null && !args.Cancelled)
{
MessageBox.Show();
}
};
client.DownloadStringAsync(X);
}
那是什麼=>在做什麼?這是我第一次看到這個。
Lambda運算符。根據我讀過的內容,當大聲說出時,它會變成「去」(就像旁註一樣)。 – 2009-10-28 23:05:56
http://msdn.microsoft.com/en-us/library/bb397687.aspx更多信息.... – 2009-10-28 23:07:06