Mega Code Archive

 
Categories / Visual C++ .NET / Collections
 

Remove a node from a LinkedList

#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^>^ node = list->Find("5");     list->AddBefore(node, "Five");     list->Remove(node); }