注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 IB客座主编(四)美国西蒙公..
 帮助

用c#读文件


2007-09-13 13:37:46
 标签:c# 编程   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://51xingfu.blog.51cto.com/219185/42286
using System;
using System.IO;
using System.Collections;

class Anagrams
{

public static void Main(String[] args)
{
StreamReader din = File.OpenText ("words.txt");
String str;
ArrayListst = new ArrayList();

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

本文出自 “幸福开心豆” 博客,请务必保留此出处http://51xingfu.blog.51cto.com/219185/42286





    文章评论
 
2007-09-13 22:27:51
C#读文件?
好好看看

2007-09-14 10:02:33
咋啦,有啥疑问不?

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: