我的代码出现以下错误
Program.Main(string[]) 并非所有代码路径都返回值
我试图理解它的确切含义,但无济于事。该代码旨在导入一个.txt充满整数的文件,然后按升序对它们进行排序。它还没有完全完成,但这是我一段时间以来最接近的:
static object Main(string[] args)
{
//take file
Console.Write("Please select file: ");
//take filename/path
string select = Console.ReadLine();
Console.Write("File " + select + " Selected, Press any key.");
Console.ReadLine();
//take contents
string[] thefile = File.ReadAllLines(select);
//generate array size
int a = 0;
foreach (string Line in thefile)
{
a++;
}
//make the list
List<int> thelist = new List<int>();
//current value in list to display
int b = 0;
foreach (string Line in thefile)
{
int …Run Code Online (Sandbox Code Playgroud) c# ×1