-3

I have made an array of objects in my c# and also initialized it but when i run the code and try to access it says null exception occurred and the code crashes. any solutions???

I have tried many methods but all in vain and I have also given a code snippet below of what I am doing.

Various links that I have visited too but some of them I weren't be able to understand and some of them are not working

Student stu = new Student[100];
stu = new Student();
  • 2
    What are you trying exactly? Your given code is not compilable but the reason is not the null exception. Can you share more information about your code? – yabadabaduhast May 09 '22 at 22:15
  • The above code is not valid, do you meant the following? Students students = new Student[100]; Student stu = new Student(); – Sonny N May 09 '22 at 22:25

0 Answers0