C# e> 泛型 循环

C# e> 泛型 循环,c#,C#,希望这对你有帮助。这是一些基本的教训;我可能会建议您学习MSDN入门级教程。除了if..else语句之外,还有更多内容。你在班上没有学过基础C#吗? private void btnAdd_Click(object sender, EventArgs e) { // Implementation Here. } private void btnAdd_Click(object sender, EventArgs e) { // Method One: "Casting"

希望这对你有帮助。这是一些基本的教训;我可能会建议您学习MSDN入门级教程。

除了
if..else
语句之外,还有更多内容。你在班上没有学过基础C#吗?
private void btnAdd_Click(object sender, EventArgs e)
{
     // Implementation Here.
}
private void btnAdd_Click(object sender, EventArgs e)
{
    // Method One: "Casting"
    // By default txtInput is a String, you require integers.  So you can add.
    /* So you would want to ensure proper Error Handling exists, otherwise when you cast you'll receive an invalid cast exception. */
    txtInput.Text = (int)data;
}
private void btnAdd_Click(object sender, EventArgs e)
{
     // Method Two: "Array"
     int[] data;
}
public partial class Form1 : Form
{
   // Create Storage
   List<string> store = new List<string>();

   private void button1_click(object sender, EventArgs e)
   {
       // Will add the input of the textbox to list each time button clicked.
       store.Add(textbox1.Text);
   }

   private void button2_click(object sender, EventArgs e)
   {
       // Logic to Add the items.
   }
}