---
title: "How to use C# List Class"  
description: "How to use C# List Class"  
author: "Anonymous User"  
published: 2015-11-05  
updated: 2015-11-05  
canonical: https://www.mindstick.com/forum/33573/how-to-use-c-sharp-list-class  
category: ".net"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How to use C# List Class

I want to use list [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) in c#.please help me

## Replies

### Reply by Anonymous User

The Collection classes are a group of classes designed specifically for grouping together objects and performing tasks on them. List class is a collection and defined in the System.Collections.Generic namespace and it provides the methods and properties like other Collection classes such as add, insert, remove, search etc.

The C# List < T > class represents a strongly typed list of objects that can be accessed by index and it supports storing values of a specific type without casting to or from object.

**List < T >**

The parameter T is the type of elements in the list.

```
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
namespace Forum
{
    public class ChildClass
    {
        static void Main(string[] args)
        {
// You can add items int List collection.
            List<Customer> CustomerList = new List<Customer>();
            Customer obj = new Customer();            obj.CustomerID = 1;
            obj.CustomerName = "Visal";
            obj.ContactNumber = "8787878787";
            CustomerList.Add(obj);
            obj = new Customer();
            obj.CustomerID = 1;
            obj.CustomerName = "Visal";
            obj.ContactNumber = "9797979797";
            CustomerList.Add(obj);
            obj = new Customer();
            obj.CustomerID = 1;
            obj.CustomerName = "Visal";
            obj.ContactNumber = "77986521322";
            CustomerList.Add(obj);

// You can retrieve items from List collection by using for loops.
            for (int i = 0; i < CustomerList.Count; i++)
            {
                Console.WriteLine("CustomerID: {0}", CustomerList[i].CustomerID);
                Console.WriteLine("CustomerName:{0}", CustomerList[i].CustomerName);
                Console.WriteLine("ContactNumber:{0}", CustomerList[i].ContactNumber +"\n");              }                       Console.ReadLine();
        }
    }
    public class Customer
    {
        public int CustomerID { get; set; }        public String CustomerName { get; set; }
        public string  ContactNumber { get; set; }
    }
}
```

```

```


---

Original Source: https://www.mindstick.com/forum/33573/how-to-use-c-sharp-list-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
