---
title: "How to add items to a List collection in C#?"  
description: "How to add items to a List collection in C#?"  
author: "Revati S Misra"  
published: 2023-11-03  
updated: 2023-11-20  
canonical: https://www.mindstick.com/forum/160381/how-to-add-items-to-a-list-collection-in-c-sharp  
category: "c#"  
tags: ["c#", "collection", "list"]  
reading_time: 1 minute  

---

# How to add items to a List collection in C#?

How to [add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios) to a List<T> [collection in C#](https://www.mindstick.com/forum/160382/describe-the-key-characteristics-of-the-dictionary-key-value-collection-in-c-sharp)?

## Replies

### Reply by Aryan Kumar

\
Certainly! In C#, you can add items to a list using the **Add** method. Here's a simple example:

```plaintext
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        // Create a list of integers
        List<int> myNumbers = new List<int>();

        // Add items to the list
        myNumbers.Add(10);
        myNumbers.Add(20);
        myNumbers.Add(30);

        // Display the contents of the list
        Console.WriteLine("List contents:");
        foreach (var number in myNumbers)
        {
            Console.WriteLine(number);
        }
    }
}
```

In this example, we create a list of integers (**List<int> myNumbers**) and use the **Add** method to add three numbers (10, 20, and 30) to the list. The **foreach** loop is then used to iterate through the list and display its contents.


---

Original Source: https://www.mindstick.com/forum/160381/how-to-add-items-to-a-list-collection-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
