首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

StreamReader读取资料

2012-10-18 
StreamReader读取文件using Systemusing System.Collections.Genericusing System.IOusing System.Linq

StreamReader读取文件

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace W
{
    class Program
    {
        static void Main(string[] args)
        {
            using (StreamReader sr = new StreamReader (@"c:\1.txt",Encoding.UTF8,true))
            {
                while (!sr.EndOfStream)
                {
                    Console.WriteLine(sr.ReadLine());
                }
            }
            Console.WriteLine("读取完毕");
            Console.ReadKey();
        }
    }
}

热点排行