在某些特殊情况下,我需要一些行前后当前位置c#streamreader文本文件读取行前/后
例如,
pubic string[] getLines(string value, int linesBefore, int linesAfter){
_streamReader = new StreamReader("file.tmp");
string[] returnValue;
string line = _streamReader.ReadLine();
while (Line.instr() < 0)
{
Line = _streamReader.ReadLine();
}
returnValue = READ "value linesBefore"
+ Line // Current Line
+ READ "value linesAfter"
}
最后3行是我需要的。
有没有简单的方法来做到这一点?
谢谢
斯特凡