-6

Consider the my following code:

for (int a = 0; a < isim.Count; a++)
{
    Console.WriteLine(nu[a] + "\t" + isim[a] + "\t" +mail[a]);
} 

Here are my execution results : enter image description here

Rann Lifshitz
  • 4,040
  • 4
  • 22
  • 42

3 Answers3

3

You are not checking to see if nu[] and mail[] are at least as large as isim[].

At least not in the code fragment you supplied. Provide more details on the error and more of a code sample if you want a more detailed answer.

bigtlb
  • 1,512
  • 10
  • 16
1
ArrayList mail = new ArrayList();
isim.Add("mail0@gmail.com");
isim.Add("mail1@yandex.com");
isim.Add("mail2@hotmail.com");
isim.Add("mail3@gmail.com");
isim.Add("mail4@gmail.com");

Instead of adding to the isim arraylist you should add them to mail arraylist.

ArrayList mail = new ArrayList();
mail.Add("mail0@gmail.com");
mail.Add("mail1@yandex.com");
mail.Add("mail2@hotmail.com");
mail.Add("mail3@gmail.com");
mail.Add("mail4@gmail.com");
Ishara Madhawa
  • 3,549
  • 5
  • 24
  • 42
1

You clearly have more elements in isim than mu. All mail addresses are being stored in isim. Check your code.

Kushal Mondal
  • 93
  • 1
  • 8