Visual C++ .NET/Collections/LinkedListNode — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 12:05, 26 мая 2010
Get last LinkedListNode
#include "stdafx.h"
#using <system.dll>
using namespace System;
using namespace System::Collections::Generic;
int main()
{
array<String^>^ arrList = gcnew array<String^> {"Two", "Three", "Four"};
LinkedList<String^>^ list = gcnew LinkedList<String^>((IEnumerable<String^>^)arrList);
list->AddLast("Six");
list->AddFirst("Zero");
list->AddAfter(list->First, "One");
list->AddBefore(list->Last, "5");
LinkedListNode<String^>^ current = list->Last;
while (current != nullptr){
Console::WriteLine(current->Value);
current = current->Previous;
}
}
Get value from LinkedListNode
#include "stdafx.h"
#using <system.dll>
using namespace System;
using namespace System::Collections::Generic;
int main()
{
array<String^>^ arrList = gcnew array<String^> {"Two", "Three", "Four"};
LinkedList<String^>^ list = gcnew LinkedList<String^>((IEnumerable<String^>^)arrList);
list->AddLast("Six");
list->AddFirst("Zero");
list->AddAfter(list->First, "One");
list->AddBefore(list->Last, "5");
LinkedListNode<String^>^ current = list->Last;
while (current != nullptr){
Console::WriteLine(current->Value);
current = current->Previous;
}
}