Home > DeveloperSection > Forums > I am getting error while assigning the data to the array list.
Elena Glibart
Elena Glibart

Total Post:33

Posted on    September-20-2016 5:53 AM

 C# C# 

 1 Reply(s)
 286  View(s)
Rate this:
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       

Abhishek Srivasatava
Abhishek Srivasatava

Total Post:15

Posted on    September-20-2016 6:07 AM

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#

Modified On Sep-20-2016 06:08:14 AM

Don't want to miss updates? Please click the below button!

Follow MindStick