小编Jay*_*erd的帖子

调试C# - 堆栈溢出异常?

下面是我的战舰游戏代码.我一直收到以下错误:

由于StackOverflowException,进程终止..

它一直指向

char[,] Grid = new char[10, 10];
Run Code Online (Sandbox Code Playgroud)

怎么解决这个问题?

using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BattleShip_Jamshid_Berdimuratov
{
class BattleshipBoard
{
    Player p = new Player();
    public void Randomize()
    {
        p.SetGrid(1, 2);
        p.SetGrid(2, 2);
        p.SetGrid(3, 2);
    }

    public void DisplayBoard(char[,] Board)
    {
        int Row;
        int Column;

        Console.WriteLine(" ¦ 0 1 2 3 4 5 6 7 8 9");
        Console.WriteLine("--+--------------------");
        for (Row = 0; Row <= 9; Row++)
        {
            Console.Write((Row).ToString() + " ¦ ");
            for (Column = 0; …
Run Code Online (Sandbox Code Playgroud)

c# stack-overflow

4
推荐指数
1
解决办法
1128
查看次数

标签 统计

c# ×1

stack-overflow ×1