日期:2014-05-17  浏览次数:20829 次

读取txt文件中的汉字
代码如下:
C# code

 FileStream fs = File.OpenRead(@"\ResidentFlash2\photo\\本机标签保存.txt");
            StreamReader sr = new StreamReader(fs,Encoding.GetEncoding("gb2312"));
            string localaddr1 = sr.ReadLine();
            sr.Close;  //错误 CS0201: 只有 assignment、call、increment、decrement 和 new 对象表达式可用作语句



关闭streamreader的时候 会报这个错误,为什么啊?大家帮忙给看下。谢谢

------解决方案--------------------
sr.Close()