为什么C#Console.WindowHeight会继续返回错误?

时间:2017-12-14 17:36:57

标签: c# window

我的代码不断在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;
}

error message that is showing up

0 个答案:

没有答案