A newbie to C# here (more C++ for many years) struggling with perhaps a simple problem, but unable to diagnose.
Class definition:
public class myClass{
String prop1, prop2,... propn;
public void setValues(String input){
prop1 = input.Substring(1,5);
prop2 = input.Substring(6,10);
...
propn = input.Substring((n-1)*5+1,n*5));
}
public getProp1() {return prop1;}
public getProp2() {return prop2;}
...
public getPropn() {return propn;}
}
In program
myClass[] Entries = new myClass[50];
int i=0;
String Line
while(i<=49){
Line = inputFile.ReadLine(); //<--System.NullReferenceException thrown here at run-time
Entries[i++].setValues(Line);
}
Any help would be sincerely appreciated to figure out this run-time exception. I'm using Visual Studio 2019, and this is a console application...if that's relevant.
Thanks in advance!