-2
我正尝试在Windows上的cmd上运行的C#中编写游戏,我需要能够写入该框的任何部分要做到这一点。我发现这个目的广泛使用WriteAt
,但它似乎并没有在VS 2010中工作,我得到的错误:错误名称'WriteAt'在当前上下文中不存在
“WriteAt
不会在当前的背景下存在的名字”我有默认:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
位于我的代码顶部。那么为什么我不能使用WriteAt
?
这里是我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GamePCL
{
class Program
{
static void Main(string[] args)
{
Console.Clear();
for (int x = 0; x < 24; x += 2)
{
WriteAt("█", x, 0);
WriteAt("█", x, 30);
}
}
}
}
你在哪里使用'WriteAt'? –
我想你需要使用'Console.WriteLine()'。 –
您确定它不是一个在内部调用SetCursorPosition的自定义方法吗? – ken2k