XXX[0]可能还需要强制类型转换一下

解决方案 »

  1.   

    ^_^ ing,既然解决了就好。
      

  2.   

    xxx[int i]
    or xxx["memberName"]
      

  3.   

    或者
    using System;
    using System.Collections;namespace ConsoleApplication1
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    class Class1
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    //
    // TODO: 在此处添加代码以启动应用程序
    //
    ArrayList arraylist = new ArrayList();
    arraylist.Add("Hello");
    arraylist.Add("World");
    arraylist.Add("!");

    System.Collections.IEnumerator Enumerator = arraylist.GetEnumerator();
    while (Enumerator.MoveNext())
    {
    Console.Write( "{0}\n", Enumerator.Current );  
    }
    }
    }
    }
      

  4.   

    再或者
    using System;
    using System.Collections;namespace ConsoleApplication1
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    class Class1
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    //
    // TODO: 在此处添加代码以启动应用程序
    //
    ArrayList arraylist = new ArrayList();
    arraylist.Add("Hello");
    arraylist.Add("World");
    arraylist.Add("!");

    for (int i=0;i<arraylist.Count;++i)
    {
    Console.Write( "{0}\n", arraylist[i] );
    }
    }
    }
    }
      

  5.   

    这是foreach的
    using System;
    using System.Collections;namespace ConsoleApplication1
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    class Class1
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    //
    // TODO: 在此处添加代码以启动应用程序
    //
    ArrayList arraylist = new ArrayList();
    arraylist.Add("Hello");
    arraylist.Add("World");
    arraylist.Add("!");
    foreach (string s in arraylist)
    {
    Console.Write( "{0}\n", s );
    }
    }
    }
    }