我在閱讀測試文件C#需要方法訪問的幫助嗎?
public static string[] method1()
{
//List<string[]> allLines = new List<string[]>();
TextReader tr = new StreamReader("data.txt");
// write a line of text to the file
string word = tr.ReadLine();
//now split this line into words
string[] val = word.Split(new Char[] { ',' });
//Console.WriteLine(val[0]);
//Console.WriteLine(val[1]);
//Console.ReadLine();
return val;
}
public static void method2()
{
method1();
var value1= val[0];
//Console.WriteLine(val[0]);
}
IT方面顯示錯誤「VAL」並不在當前的背景下存在的名字下面的程序。如何解決這個問題?
感謝所有的工作:-) – 1630082