Mid Collections

How do you add elements to the start or end of a LinkedList<T>?

  • Use AddFirst(value) to add at the start.
  • Use AddLast(value) to add at the end.

numbers.AddFirst(5); // Adds 5 at the beginning

numbers.AddLast(30); // Adds 30 at the end

More from C# Programming Tutorial

All questions for this course