30th Nov 2020, 1:45 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar
2 Respuestas
+ 3
Line 13, `private string[] names = new string[1];` Here, you have set the maximum capacity of the array to 1. But on line 30, `u[1] = "oritseweyinmi";` you are setting the one-th index, which does not exists as the maximum capacity is 1. Set the maximum capacity of the array to 2 (or more according to your needs), and it will work. You can also take a size in the constructor of the class, and set length of the array to that.
30th Nov 2020, 2:12 PM
XXX
XXX - avatar
0
Thanks
30th Nov 2020, 2:16 PM
Joseph Oritseweyinmi
Joseph Oritseweyinmi - avatar