2010-09-01 64 views
1

當前正在關注monotouch website的HelloWorld教程。MonoDevelop的錯誤HelloWorld

我添加以下代碼具體根據教程:

 int ntaps = 0; 
     button.TouchDown += delegate { 
      label.Text = "I have been tapped " (++ntaps) + " times"; 
     }; 

然而,當我建立我得到問候此錯誤的代碼的3上面的行:「表達式表示‘值’,其中一個'方法組'被期望「。

任何想法可能會出錯?

回答

3

你錯過的字符串連接加分操作:

int ntaps = 0; 
button.TouchDown += delegate { 
    label.Text = "I have been tapped " + (++ntaps) + " times"; 
}; 
0

你錯過+後,「我一直在挖掘」;

int ntaps = 0; 
    button.TouchDown += delegate { 
     label.Text = "I have been tapped " + (++ntaps) + " times"; 
    };