我对这一切都很陌生,但我觉得我已经接近完成这项工作了,我只需要一点帮助!我想创建一个 DLL,它可以读取并返回在另一个应用程序中打开的文件中的最后一行。这就是我的代码的样子,我只是不知道在 while 语句中放什么。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace SharedAccess
{
public class ReadShare {
static void Main(string path) {
FileStream stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
StreamReader reader = new StreamReader(stream);
while (!reader.EndOfStream)
{
//What goes here?
}
}
}
}