ArrayList ImportantData = new ArrayList();
为何编译时,通不过??
--------------------Configuration: InspectCar - Win32 Debug--------------------
Compiling...
InspectCarDlg.cpp
D:\Inspect\Inspect.cpp(466) : error C2065: 'ArrayList' : undeclared identifier
......InspectCar.exe - 102 error(s), 0 warning(s)缺少头文件吗?

解决方案 »

  1.   

    Requirements
    Namespace: System.CollectionsAssembly: mscorlib.dll
    [C#] 
    using System;
    using System.Collections;
    public class SamplesArrayList  {   public static void Main()  {      // Create and initialize a new ArrayList.
          ArrayList myAL = new ArrayList();
          myAL.Add("Hello");
          myAL.Add("World");
          myAL.Add("!");      // Display the properties and values of the ArrayList.
          Console.WriteLine( "myAL" );
          Console.WriteLine( "\tCount:    {0}", myAL.Count );
          Console.WriteLine( "\tCapacity: {0}", myAL.Capacity );
          Console.Write( "\tValues:" );
          PrintValues( myAL );
       }   public static void PrintValues( IEnumerable myList )  {
          System.Collections.IEnumerator myEnumerator = myList.GetEnumerator();
          while ( myEnumerator.MoveNext() )
             Console.Write( "\t{0}", myEnumerator.Current );
          Console.WriteLine();
       }
    }myAL
        Count:    3
        Capacity: 16
        Values:    Hello    World    !