Can ArrayList hold array?
Ngày đăng:
25/12/2021
Trả lời:
0
Lượt xem:
79
ArrayList Class
Is this page helpful?
Please rate your experience
Yes
No
Any additional feedback?
Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services. Privacy policy. Show
Submit
Thank you. Definition
Namespace:
System.Collections
Assemblies:mscorlib.dll, System.Collections.NonGeneric.dll
Assembly:System.Runtime.dll
Assembly:System.Collections.NonGeneric.dll
Assembly:System.Runtime.Extensions.dll
Assembly:mscorlib.dll
Assembly:netstandard.dll
Important Some information relates to prerelease product that may be substantially modified before its released. Microsoft makes no warranties, express or implied, with respect to the information provided here. Implements the IList interface using an array whose size is dynamically increased as required. In this articlepublic ref class ArrayList : System::Collections::IList public ref class ArrayList : ICloneable, System::Collections::IList public class ArrayList : System.Collections.IList public class ArrayList : ICloneable, System.Collections.IList [System.Serializable] public class ArrayList : ICloneable, System.Collections.IList [System.Serializable] [System.Runtime.InteropServices.ComVisible(true)] public class ArrayList : ICloneable, System.Collections.IList type ArrayList = class interface IEnumerable interface IList interface ICollection type ArrayList = class interface ICollection interface IEnumerable interface IList interface ICloneable type ArrayList = class interface IEnumerable interface IList interface ICollection interface ICloneable [Object
ArrayList
System.Windows.Forms.DomainUpDown.DomainUpDownItemCollection
Attributes
SerializableAttribute
ComVisibleAttribute
Implements
ICollection
IEnumerable
IList
ICloneable
ExamplesThe following example shows how to create and initialize an ArrayList and how to display its values. using namespace System; using namespace System::Collections; void PrintValues( IEnumerable^ myList ); int main() { // Creates and initializes a new ArrayList. ArrayList^ myAL = gcnew ArrayList; myAL->Add( "Hello" ); myAL->Add( "World" ); myAL->Add( "!" ); // Displays the properties and values of the ArrayList. Console::WriteLine( "myAL" ); Console::WriteLine( " Count: {0}", myAL->Count ); Console::WriteLine( " Capacity: {0}", myAL->Capacity ); Console::Write( " Values:" ); PrintValues( myAL ); } void PrintValues( IEnumerable^ myList ) { IEnumerator^ myEnum = myList->GetEnumerator(); while ( myEnum->MoveNext() ) { Object^ obj = safe_cast |