No, nodes are not recycled.
As you can see from the reference source, new nodes are created when new data is added.
public LinkedListNode<T> AddFirst(T value) {
LinkedListNode<T> result = new LinkedListNode<T>(this, value);
...
}
Question
When using the overloads which directly accept your data (i.e. linkedList.AddFirst(myData)
and linkedList.RemoveFirst()
), does .NET internally recycle its link nodes?
Or would this need to be accomplished manually with a Queue?
Solution
No, nodes are not recycled.
As you can see from the reference source, new nodes are created when new data is added.
public LinkedListNode<T> AddFirst(T value) {
LinkedListNode<T> result = new LinkedListNode<T>(this, value);
...
}