我希望这两个文本文件在调试时都出现,我知道我需要将它们放在数组中,但是我该怎么做呢? [英] I want both of these text files to appear when I debug, I know I need to put them in arrays but how do I do this?
问题描述
ReadFromFile(@"D:\ Depths.txt");
}
静态void ReadFromFile(string aTextFile)
{
System.IO.StreamReader InputFile =新的System.IO.StreamReader(aTextFile);
字符串s;
while(!InputFile.EndOfStream)
{
s = InputFile.ReadLine();
Console.WriteLine(s);
}
{
ReadFromFile(@"speed.txt");
}
静态void ReadFromFile(string TextFile)
{
System.IO.StreamReader nputFile =新的System.IO.StreamReader(TextFile);
字符串x;
而(!nputFile.EndOfStream)
{
x = nputFile.ReadLine();
Console.WriteLine(x);
}
我尝试过的事情:
我需要用相同的代码读取两个文件,并且当我调试
ReadFromFile(@"D:\Depths.txt");
}
static void ReadFromFile(string aTextFile)
{
System.IO.StreamReader InputFile = new System.IO.StreamReader(aTextFile);
string s;
while (!InputFile.EndOfStream)
{
s = InputFile.ReadLine();
Console.WriteLine(s);
}
{
ReadFromFile(@"speed.txt");
}
static void ReadFromFile(string TextFile)
{
System.IO.StreamReader nputFile = new System.IO.StreamReader(TextFile);
string x;
while (!nputFile.EndOfStream)
{
x = nputFile.ReadLine();
Console.WriteLine(x);
}
What I have tried:
I need to read both files in the same code and need them both to appear on the screen when I debug
推荐答案
string FileNumberOne = System.IO.File.ReadAllText(@"D:\Depths.txt");
string FileNumberTwo = System.IO.File.ReadAllText(@"speed.txt");
时,它们都必须出现在屏幕上
您肯定会在调试中看到变量的值.
:-)
You sure will see the value of variables in debug.
:-)
这篇关于我希望这两个文本文件在调试时都出现,我知道我需要将它们放在数组中,但是我该怎么做呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!