//编译的时候,提示ArrayList是个命名空间,不能当做类型用。我想实现的效果就是声明一个ArrayList 的实例a1,用来存取数据,应该怎样写代码?using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;namespace ArrayList
{
  class Program
  {
    
  static void Main(string[] args)
  {
  ArrayList listarray = new ArrayList();  listarray.Add("I am");
    
    
  }
  }
}

解决方案 »

  1.   

    namespace ArrayList --这里冲突了
    {
      class Program
      {
        
      static void Main(string[] args)
      {
      ArrayList listarray = new ArrayList();  listarray.Add("I am");
        
        
      }
      }
      

  2.   

    别用ArrayList了 用List<T>吧
      

  3.   

    楼主的命名空间和 系统的一样了都是ArrayList
    方法一  static void Main(string[] args)
      {
      using System.Collections.ArrayList listarray = new using System.Collections.ArrayList();
      listarray.Add("I am");
      }
    方法二
    更改命名空间 namespace ArrayListTest
      

  4.   

    手唔了。  static void Main(string[] args)
      {
      using System.Collections.ArrayList listarray = System.Collections.ArrayList();
      listarray.Add("I am");
      }
      

  5.   


    第三使用
    LIST<>存储
      

  6.   

    今天怎么了。。 快下了班了 有点毛了。
    下面是正确代码  static void Main(string[] args)
      {
         System.Collections.ArrayList listarray = System.Collections.ArrayList();
         listarray.Add("I am");
      }
      

  7.   

    杯具了  static void Main(string[] args)
      {
         System.Collections.ArrayList listarray =new System.Collections.ArrayList();
         listarray.Add("I am");
      }
      

  8.   

    System.Collections.ArrayList listarray =new System.Collections.ArrayList();