댓글 쓰기 권한이 없습니다. 로그인 하시겠습니까?
|
MFC
2017.01.25 09:06
[Collection] ArrayList 예제
조회 수 20986 댓글 0
https://msdn.microsoft.com/ko-kr/library/system.collections.arraylist(v=vs.110).aspx?f=255&MSPPError=-2147217396&cs-save-lang=1&cs-lang=cpp#code-snippet-1 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<Object^>(myEnum->Current);
Console::Write( " {0}", obj );
}
Console::WriteLine();
}
/*
This code produces output similar to the following:
myAL
Count: 3
Capacity: 4
Values: Hello World !
*/
Dreamy의 코드 스크랩내가 모으고 내가 보는
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Designed by sketchbooks.co.kr / sketchbook5 board skin
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5
Sketchbook5, 스케치북5