最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

c#簡單讀取文本的實(shí)例方法

 更新時間:2013年04月08日 17:18:51   作者:  
c#簡單讀取文本的實(shí)例方法,需要的朋友可以參考一下

復(fù)制代碼 代碼如下:

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

namespace StreamReadWrite
{
    class Program
    {
        static void Main(string[] args)
        {
            // Get the directories currently on the C drive.
            DirectoryInfo[] cDirs = new DirectoryInfo(@"e:\").GetDirectories();

            // Write each directory name to a file.
            using (StreamWriter sw = new StreamWriter("CDriveDirs.txt"))
            {
                foreach (DirectoryInfo dir in cDirs)
                {
                    sw.WriteLine(dir.Name);

                }
            }

            // Read and show each line from the file.
            string line = "";
            using (StreamReader sr = new StreamReader("CDriveDirs.txt"))
            {
                while ((line = sr.ReadLine()) != null)
                {
                    Console.WriteLine(line);
                }
            }
        }
    }
}   

相關(guān)文章

最新評論

城口县| 台山市| 镶黄旗| 乐陵市| 枣强县| 资溪县| 什邡市| 兰坪| 乌兰察布市| 嘉义县| 酉阳| 成安县| 盘山县| 门源| 黄陵县| 满洲里市| 沙湾县| 贡嘎县| 罗平县| 湘阴县| 天长市| 义乌市| 华亭县| 蒙山县| 和龙市| 基隆市| 吉安市| 拉萨市| 远安县| 叶城县| 江门市| 洛扎县| 常山县| 炎陵县| 千阳县| 张家口市| 隆昌县| 乐都县| 长治县| 太仓市| 兴山县|