我正在尝试将文本文件中的一行拆分为 4 个字符串和 1 个 int。我不知道如何提取 int 部分。
有人可以帮我吗?
StreamReader infil = new StreamReader("moviefile.txt", Encoding.GetEncoding(28591));
for (;;)
{
string line = infil.ReadLine();
if (line == null) break;
string[] parts = line.Split('\t');
Movie movie = new Movie();
movie.title = parts[0];
movie.genre = parts[1];
movie.release = parts[2];
movie.actor = parts[3];
movie.director = parts[4];
AddMovie(movie);
}