---
title: "What is IEnumerable In C#."  
description: "What is IEnumerable In C#."  
author: "Anonymous User"  
published: 2015-11-06  
updated: 2015-11-06  
canonical: https://www.mindstick.com/forum/33575/what-is-ienumerable-in-c-sharp  
category: ".net"  
tags: ["c#"]  
reading_time: 1 minute  

---

# What is IEnumerable In C#.

I want to use IEnumerable In C# please give me [solutions](https://www.mindstick.com/articles/12807/product-searching-issues-and-solutions-for-ecommerce-store-advanced-search-autocomplete-suggest)

## Replies

### Reply by Anonymous User

The IEnumerable<T> is used to iterate a read only collection. It has only one method GetEnumeartor() which allows you to iterate the read only collection using a foreach loop. It only iterates in the forward direction. IEnumerable <T> is defined in as follows:

```
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)
        {
            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);

            IEnumerable<Customer> EnumList = CustomerList;

            foreach(Customer o in EnumList)
            {
                Console.WriteLine("CustomerID: {0}",o.CustomerID);
                Console.WriteLine("CustomerName: {0}", o.CustomerName);
                Console.WriteLine("ContactNumber: {0}", o.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/33575/what-is-ienumerable-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
