Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->编程语言 ->ASP ->正文

用c#读文件

来源:Linuxdby.com 作者:Webmaster 时间:2007-04-23 点击: [收藏] [投稿]
using System;
using System.IO;
using System.Collections;

class Anagrams
{
    
    public static void Main(String[] args)
    {
        StreamReader din = File.OpenText ("words.txt");
        String str;
        StringTable st = new StringTable();
        
        Console.WriteLine("Reading data and insterting into a StringTable.");
        while ((str=din.ReadLine()) != null) {
            st.Add(str);
        }
        Console.WriteLine("Printing out the StringTable.");
        foreach (string s in st)


        {
            Console.WriteLine (s);
        }
        
        Console.WriteLine ("\r\nPress Return to exit.");
        Console.Read();
    }
}




 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:datalist分页(codebehind部分)   下一篇:<<展现C#>> 第八章 用C#写组件(rainbow 翻译) (来自重粒子空间)

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号