gpt4 book ai didi

c# - “检测到无法访问的代码”我已经查看了其他无法访问的代码,但我似乎无法修复我的,halp

转载 作者:太空宇宙 更新时间:2023-11-03 18:53:36 26 4
gpt4 key购买 nike

我正在为学校做一个 tictactoe 项目,我似乎无法解决无法访问的代码问题。我已经查找了其他无法访问的代码问题,但我不确定如何解决它,因为我不太擅长这个。我知道这是一个警告,但是当我启动我的程序时,它不会在我按下 em 时填充空白。

    private void Movement(object sender, EventArgs e)
{
if (InvokeRequired)
{
this.Invoke(new Action<object, EventArgs>(Movement), new object[] { sender, e });
return;
UpdateData(sender); //This is where it points for unreachable
var lbl = (Label)sender;
lbl.Enabled = false;
lbl.Text = currentPlayer.ToString();
if (!CheckWin())
NextTurn();

}
}
private void UpdateData(object sender)
{
Label lbl = sender as Label;
if (lbl == lbl00)
GameData[0, 0] = currentPlayer;
else if (lbl == lbl10)
GameData[1, 0] = currentPlayer;
else if (lbl == lbl20)
GameData[2, 0] = currentPlayer;
else if (lbl == lbl01)
GameData[0,1] = currentPlayer;
else if (lbl == lbl11)
GameData[1, 1] = currentPlayer;
else if (lbl == lbl21)
GameData[2, 1] = currentPlayer;
else if (lbl == lbl02)
GameData[0, 2] = currentPlayer;
else if (lbl == lbl12)
GameData[1, 2] = currentPlayer;
else if (lbl == lbl22)
GameData[2, 2] = currentPlayer;
}

最佳答案

因为你放了一个returnthis.Invoke(new Action<object, EventArgs>(Movement), new object[] { sender, e }); 之后线路所以其他线路无法到达

关于c# - “检测到无法访问的代码”我已经查看了其他无法访问的代码,但我似乎无法修复我的,halp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50800400/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com