Skip to content

Instantly share code, notes, and snippets.

@GER-NaN
Created December 30, 2016 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GER-NaN/0fcbb6b7f42454c249f25ba1994cd366 to your computer and use it in GitHub Desktop.
Save GER-NaN/0fcbb6b7f42454c249f25ba1994cd366 to your computer and use it in GitHub Desktop.
List of Node
/*
https://msdn.microsoft.com/en-us/library/ms379572(v=vs.80).aspx
An Extensive Examination of Data Structures Using C# 2.0
Visual Studio 2005
Scott Mitchell
4GuysFromRolla.com
Update January 2005
*/
public class NodeList<T> : Collection<Node<T>>
{
public NodeList() : base() { }
public NodeList(int initialSize)
{
// Add the specified number of items
for (int i = 0; i < initialSize; i++)
base.Items.Add(default(Node<T>));
}
public Node<T> FindByValue(T value)
{
// search the list for the value
foreach (Node<T> node in Items)
if (node.Value.Equals(value))
return node;
// if we reached here, we didn't find a matching node
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment