首页 > 开发 > 综合 > 正文

用c#读文件

2024-07-21 02:25:26
字体:
来源:转载
供稿:网友

商业源码热门下载www.html.org.cn

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();
    }
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表