ArryList数组使用

using  System;
using  System.Collections;
class  ArrList
{
    
static void Main()
    
{
        ArrayList arr 
= new ArrayList();
        
string str1;
        
while (true)
        
{
            Console.WriteLine(
"请输入一个字符到ArrayList:");
            str1 
= Console.ReadLine();
            
if (str1 == "end")
            
{   break;}

            arr.Add(str1);
            
for (int i = 0; i < arr.Count; i++)
            
{
                Console.Write(
"{0}", arr[i]);
                Console.WriteLine(
" ");
            }

        }

    }

}
 

你可能感兴趣的:(C#)