如果满足不同的条件,我目前正在制作一个脚本来显示特定的 MessageBox。我有 8 个条件要检查,如果它们是“0”或“1”,它们中的每一个都必须显示不同的 MessageBox。
我的代码的简化示例如下:
// Similar if(y[1] == "1") statements above with similar Messages but without the corresponding fruit(s)
if (y[2] == "1")
{ MessageBox.Show("Multiple goods required! Please get the following
items off the shelves" + Environment.NewLine +
"1. Apple" + Environment.NewLine + "2. Pear" +
Environment.NewLine + "3. Orange");
}
else if (y[2] == "0")
{ MessageBox.Show("Multiple goods required! Please get the following
items off the shelves" + Environment.NewLine +
"1. Apple" + Environment.NewLine + "2. Pear");
}
我的C#知识很基础,但我愿意学习!请帮忙!