我的代码不断在NotSuppportedException
行投放Console.WindowHeight
。
我想知道为什么以及我能做些什么来修复它?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
static int firstPlayerPadSize = 10;
static int secondPlayerPadSize = 4;
static int ballPositionX = 0;
static int ballPositionY = 0;
static bool ballDirectionUp = true; //Determines if the ball direction is up
static bool ballDirectionRight = false;
static int firstPlayerPosition = 0;
static int secondPlayerPosition = 0;
static int firstPlayerResult = 0;
static int secondPlayerResult = 0;
static Random randomGenerator = new Random();
//***************
//START MODEL
//*****************
public void Screen()
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BufferHeight = Console.WindowHeight;
Console.BufferWidth = Console.WindowWidth;
}