用c#读文件
点击次数:69 次 发布日期:2008-11-06 08:06:07 作者:源代码网
|
源代码网推荐 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 (" Press Return to exit."); 源代码网推荐 Console.Read(); 源代码网推荐 } 源代码网推荐 } 源代码网推荐 源代码网推荐 源代码网推荐 源代码网供稿. |
