---
title: "I am getting error while assigning the data to the array list."  
description: "I am getting error while assigning the data to the array list."  
author: "Elena Glibart"  
published: 2016-09-20  
updated: 2016-09-20  
canonical: https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# I am getting error while assigning the data to the array list.

Hi Guys\
I am not able to excute this part of the program.Plese help me\

```
ArrayList array1 =new ArrayList ();for(int i=0;i<10;i++){ArrAdd(i)   = convert.ToInt32(Console.ReadLine());// getting error Arr(i)=   convert.ToInt32(Console.ReadLine());// getting error       }
```

\

## Replies

### Reply by Abhishek Srivasatava

Hello Elena ,

Here is the correct code for your query, Please proceed.

```
ArrayList array1 = new ArrayList();
string Input1;           for(int i = 0; i < 10;i++)            {               Input1 = Console.ReadLine();   
             Array1.Add(Convert.ToInt32(Input1));            } 
```

For more details click here: [Basic Concept of Collection in C#](https://www.mindstick.com/blog/11208/basic-concept-of-collection-in-c-sharp)


---

Original Source: https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
