C# | Adding an element to the List Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report List.Add(T) Method is used to add an object to the end of the List. Properties of List: It is different from the arrays. A list can be resized dynamically but arrays cannot. List class can accept null as a valid value for reference types and it also allows duplicate elements. If the Count becomes equals to Capacity then the capacity of the List increases automatically by reallocating the internal array. The existing elements will be copied to the new array before the addition of the new element. If the Count is less than Capacity then this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element then this method becomes an O(n) operation. Syntax: public void Add (T item); Parameter: item: Specified object which is to be added to the end of the List of type System.Object. Below programs illustrate how to add an element in List: Example 1: CSharp // C# program to add element in List<T> using System; using System.Collections.Generic; class Geeks { // Main Method public static void Main(String[] args) { // Creating a List of integers List<int> firstlist = new List<int>(); // adding elements in firstlist for (int i = 4; i < 10; i++) { firstlist.Add(i * 2); } // Displaying elements of firstlist // by using foreach loop foreach(int element in firstlist) { Console.WriteLine(element); } } } Output: 8 10 12 14 16 18 Example 2: CSharp // C# program to add element in List<T> using System; using System.Collections.Generic; class Geeks { // Main Method public static void Main(String[] args) { // Creating a List of integers List<int> firstlist = new List<int>(); // adding elements in firstlist firstlist.Add(1); firstlist.Add(2); firstlist.Add(3); firstlist.Add(4); // Adding some duplicate // elements in firstlist firstlist.Add(3); firstlist.Add(4); // Displaying elements of firstlist // by using foreach loop foreach(int element in firstlist) { Console.WriteLine(element); } } } Output: 1 2 3 4 3 4 Reference: https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.add?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | Removing all the elements from the List K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Generic-List CSharp-Collections-Namespace CSharp-Generic-Namespace +1 More Similar Reads C# | How to insert an element in an Array? An array is a collection of items stored at contiguous memory locations. In this article, we will see how to insert an element in an array in C#. Let's say we have an array and we want to insert an element at a specific position in this array. Here's how to do it. First get the element to be inserte 2 min read C# | Removing all the elements from the List List class represents the list of objects which can be accessed by index. It comes under the System.Collection.Generic namespace. List class can be used to create a collection of different types like integers, strings etc. List class also provides the methods to search, sort, and manipulate lists. L 3 min read C# | Add an object to the end of the ArrayList ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list. ArrayList.Add(Object) method adds an object to the end of the ArrayList. Pr 2 min read C# | Adding the elements of the specified collection to the end of the List List<T>.AddRange(IEnumerable<T>) Method is used to add the elements of the specified collection to the end of the List<T>. Properties of List: It is different from the arrays. A list can be resized dynamically but arrays cannot. List class can accept null as a valid value for refer 3 min read C# | Count the total number of elements in the List List class represents the list of objects which can be accessed by index. It comes under the System.Collection.Generic namespace. List class can be used to create a collection of different types like integers, strings etc. List class also provides the methods to search, sort, and manipulate lists. L 2 min read C# | Insert an element into the ArrayList at the specified index ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list. ArrayList.Insert(Int32, Object) method inserts an element into the ArrayLis 3 min read Like