为什么卡片会在下方更换?让我感到困惑..理解通过ref传递哪个工作正常..但是当传递数组时并没有像我预期的那样做.在.NET3.5SP1下编译
非常感谢
void btnCalculate_Click(object sender, EventArgs e)
{
string[] cards = new string[3];
cards[0] = "old0";
cards[1] = "old1";
cards[2] = "old2";
int betResult = 5;
int position = 5;
clsRules myRules = new clsRules();
myRules.DealHand(cards, betResult, ref position); // why is this changing cards!
for (int i = 0; i < 3; i++)
textBox1.Text += cards[i] + "\r\n"; // these are all new[i] .. not expected!
textBox1.Text += "betresult " + betResult.ToString() + "\r\n"; // this is 5 as …Run Code Online (Sandbox Code Playgroud) c# ×1