锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
聽聽聽System.IO.StreamWriter sw=new System.IO.StreamWriter(fileName);
聽聽聽sw.WriteLine(System.DateTime.Now);
聽聽聽sw.Close();
聽聽聽if(System.IO.File.Exists(fileName))
聽聽聽{
聽聽聽聽System.IO.StreamReader sr=new System.IO.StreamReader(fileName);
聽聽聽聽String line=null;
聽聽聽聽while((line=sr.ReadLine())!=null)
聽聽聽聽{
聽聽聽聽聽System.Console.WriteLine(line);
聽聽聽聽}
聽聽聽聽sr.Close();
聽聽聽}
//ArrayList
System.Collections.ArrayList list=new System.Collections.ArrayList();
list.Add(1);
list.Add(2);
for(int i=0;i<list.Count;i++)
{
聽System.Console.WriteLine(list[i]);
}
//HashTable
System.Collections.Hashtable table=new System.Collections.Hashtable();
table.Add("table1",1);
table.Add("table2",2);
System.Collections.IDictionaryEnumerator d=table.GetEnumerator();
while(d.MoveNext())
{
聽System.Console.WriteLine(d.Entry.Key);
}
//Queue
System.Collections.Queue queue=new System.Collections.Queue();
queue.Enqueue(1);
queue.Enqueue(2);
System.Console.WriteLine(queue.Peek());
while(queue.Count>0)
{
聽System.Console.WriteLine(queue.Dequeue());
}
//SortedList
System.Collections.SortedList list=new System.Collections.SortedList();
list.Add("key2",2);
list.Add("key1",1);
for(int i=0;i<list.Count;i++)
{
聽System.Console.WriteLine(list.GetKey(i));
}
//Stack
System.Collections.Stack stack=new System.Collections.Stack();
stack.Push(1);
stack.Push(2);
System.Console.WriteLine(stack.Peek());
while(stack.Count>0)
{
聽System.Console.WriteLine(stack.Pop());
}