点滴技术之学

每天进步一点点 一天一小步 十天一大步
  博客园  :: 首页  :: 新随笔  :: 联系 :: 管理

数组ArrayList使用实例

Posted on 2008-10-02 19:40  风沙飞天  阅读(218)  评论(0编辑  收藏  举报

/*
数组ArrayList使用
 */

using System;
using System.Collections;
class ArrList
{
 static void Main()
 {
  ArrayList arr=new ArrayList();
  string str1;
  while(true)
  {
   Console.WriteLine("Please add a string to ArrayList:");
   str1=Console.ReadLine();
   if(str1=="end")
    break;
   arr.Add(str1);
   Console.WriteLine();
   for(int i=0;i<arr.Count;i++)
    Console.Write("{0}",arr[i]);
   Console.WriteLine("\n");
   
  }
 }
}