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

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

 更新時(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)文章

最新評(píng)論

柘荣县| 黔南| 商水县| 宁南县| 普兰店市| 威信县| 杂多县| 六盘水市| 新竹县| 剑阁县| 曲松县| 始兴县| 安庆市| 额尔古纳市| 郁南县| 秦皇岛市| 且末县| 怀化市| 宣武区| 浏阳市| 迁安市| 怀宁县| 梧州市| 永靖县| 赤城县| 灵宝市| 渝北区| 神木县| 齐齐哈尔市| 宜宾县| 安多县| 屏山县| 蓬溪县| 资中县| 措美县| 丰都县| 南木林县| 保亭| 科技| 彝良县| 仙桃市|