I AM GETTING ERROR WHILE ASSIGNING THE DATA TO THE ARRAY LIST.

Elena Glibart

Total Post:42

Points:296
Posted by  Elena Glibart
C# 
C#
 546  View(s)
Ratings:
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       
}

  1. Abhishek Srivasatava

    Post:24

    Points:168
    Re: I am getting error while assigning the data to the array list.

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!