This post will discuss how to insert elements at the end of a list in C#.

1. Using List<T>.Add() method

The standard solution to add a value to the end of the list is using the List<T>.Add() method. The following example demonstrates how to add a value in a List<T>.

Download  Run Code

2. Using Enumerable.Append() method

Alternatively, you can use the Enumerable.Append() method to add a value at the end of a sequence. This returns a copy of the sequence with the new item, and leaves the original sequence untouched. It is available with .NET >= 4.7.1, and can be invoked as below:

Download  Run Code

3. Using LinkedList<T>.AddLast() method

To adds a new value at the end of the LinkedList<T>, consider using the AddLast() method. The linked list implementation provides a more complete and consistent set of LIFO and FIFO operations. Here’s an example of its usage:

Download  Run Code

That’s all about inserting elements at the end of a list in C#.