【发布时间】:2017-08-17 07:34:54
【问题描述】:
在c#中有多少种方式打开文件?哪个最好?以及如何打开.exe文件?很抱歉这个愚蠢的问题,但我是 C# 的新手。
using (StreamReader srStreamReader = new StreamReader(sString))
{
while ((sline = srStreamReader.ReadLine()) != null)
{
Console.WriteLine(sline);
}
}
我为此使用此代码,但我不能。所以请帮忙
【问题讨论】:
-
以加载其内容到缓冲区的方式打开还是以执行方式打开? - 如果是前者 File.ReadAllBytes() 如果后者是 Process.Start()
-
检查this answer。