以文件流的方式读取本地文件

//c#文件流读文件 
            using (FileStream fsRead = new FileStream(@"D:file	xt.html", FileMode.Open,FileAccess.Read,FileShare.Read))
            {
                int fsLen = (int)fsRead.Length;
                byte[] heByte = new byte[fsLen];
                int r = fsRead.Read(heByte, 0, heByte.Length);
                Encoding encode = System.Text.Encoding.GetEncoding("unicode");//以Unicode方式读取文件
                string myStr =encode.GetString(heByte);
                Console.WriteLine(myStr);
                Console.ReadKey();
            }
原文地址:https://www.cnblogs.com/kongxiaoshuang/p/6529267.html