C# winfrom 读取txt文本内容

第一种:

        /// <summary>
        /// 读取txt文件内容
        /// </summary>
        /// <param name="Path">文件地址</param>
        public void ReadTxtContent(string Path)
        {
            StreamReader sr = new StreamReader(Path, Encoding.Default);
            string content;
            while ((content = sr.ReadLine()) != null)
            {
                Console.WriteLine(content.ToString());
            }
        }

猜你喜欢

转载自www.cnblogs.com/yinmu/p/10994947.html