C# List Add & Insert
last modified October 16, 2026
In this article we show how to add new elements to a list in C#.
A C# List<T> is a collection of elements of the same type.
The elements can be accessed by index. Unlike an array, a list grows
automatically when we add elements.
In C#, we can use the Add, AddRange,
Insert, and InsertRange methods to add elements to a
list.
C# List Add
The Add method appends an element to the end of a list.
List<string> words = ["sky", "war", "crypto"];
words.Add("water");
Console.WriteLine(string.Join(",", words));
words.Add("falcon");
Console.WriteLine(string.Join(",", words));
words.Add("soap");
Console.WriteLine(string.Join(",", words));
We define a list of words. Using Add, we append three new
words.
$ dotnet run sky,war,crypto,water sky,war,crypto,water,falcon sky,war,crypto,water,falcon,soap
C# List AddRange
The AddRange method appends the elements of a collection to the
end of the list.
List<string> words = ["sky", "war", "crypto"];
List<string> words2 = ["falcon", "soap"];
string[] words3 = ["book", "cloud"];
HashSet<string> words4 = ["money", "dog"];
Console.WriteLine(string.Join(",", words));
words.AddRange(words2);
Console.WriteLine(string.Join(",", words));
words.AddRange(words3);
Console.WriteLine(string.Join(",", words));
words.AddRange(words4);
Console.WriteLine(string.Join(",", words));
In the example, we add the elements of another list, an array, and a set to the
initial list of strings. AddRange accepts any
IEnumerable<T>. Note that the order of the elements of a
HashSet is not guaranteed.
$ dotnet run sky,war,crypto sky,war,crypto,falcon,soap sky,war,crypto,falcon,soap,book,cloud sky,war,crypto,falcon,soap,book,cloud,money,dog
C# List Insert
The Insert method inserts an element into a list at the specified
index. The elements at and after the index are shifted to the right.
List<string> words = ["sky", "war", "crypto"];
words.Insert(0, "storm");
words.Insert(2, "cloud");
words.Insert(words.Count, "fortress");
Console.WriteLine(string.Join(",", words));
try
{
words.Insert(10, "rock");
}
catch (ArgumentOutOfRangeException e)
{
Console.WriteLine(e.Message);
}
In the program, we insert a word at the beginning, in the middle, and at the end
with Insert.
words.Insert(words.Count, "fortress");
Inserting at the index equal to Count appends the element to the
end; it is the same as Add.
words.Insert(10, "rock");
An index greater than Count or a negative index throws an
ArgumentOutOfRangeException.
$ dotnet run storm,sky,cloud,war,crypto,fortress Index must be within the bounds of the List. (Parameter 'index')
C# List InsertRange
The InsertRange method inserts the elements of a collection at the
specified index.
List<string> words = ["sky", "war", "crypto"];
List<string> words2 = ["falcon", "soap"];
string[] words3 = ["book", "cloud"];
Console.WriteLine(string.Join(",", words));
words.InsertRange(0, words2);
Console.WriteLine(string.Join(",", words));
words.InsertRange(3, words3);
Console.WriteLine(string.Join(",", words));
In the program, we insert the elements of another list at the beginning and the elements of an array in the middle of the initial list.
$ dotnet run sky,war,crypto falcon,soap,sky,war,crypto falcon,soap,sky,book,cloud,war,crypto
C# collection expressions
Since C# 12, we can create a new list from existing collections with a
collection expression. The spread element .. inserts all elements
of a collection.
List<string> words = ["sky", "war", "crypto"];
string[] more = ["book", "cloud"];
List<string> all = ["start", .. words, "middle", .. more];
Console.WriteLine(string.Join(",", all));
Console.WriteLine(string.Join(",", words));
Unlike AddRange and InsertRange, the collection
expression creates a new list; the original lists are not modified.
$ dotnet run start,sky,war,crypto,middle,book,cloud sky,war,crypto
Performance
A list stores its elements in an internal array. Adding an element to the end
with Add is fast; when the array is full, the list allocates a
larger one and copies the elements. Inserting at the beginning or in the middle
is slower, because all the following elements must be shifted.
var vals = new List<int>();
for (int i = 0; i < 10; i++)
{
vals.Add(i);
Console.Write($"{vals.Count}/{vals.Capacity} ");
}
Console.WriteLine();
var vals2 = new List<int>(1000);
Console.WriteLine(vals2.Capacity);
The Capacity property shows the size of the internal array. It
doubles when the list is full. If we know the number of elements in advance, we
can set the capacity in the constructor and avoid the reallocations.
$ dotnet run 1/4 2/4 3/4 4/4 5/8 6/8 7/8 8/8 9/16 10/16 1000
Source
In this article we have shown how to add new elements to a list in C#.
Author
List all C# tutorials.