I have a static class that looks like this:
namespace Argus
{
static class Argus
{
public static List<Branch> myArgus;
}
}
and elsewhere in my code I have this:
// Add this branch to myArgus
Argus.myArgus.Add(branch);
When I run the code, I get this error:
Object reference not set to an instance of an object.
I have verified that branch is valid (it's an object of the Branch class), and have no idea what could be wrong here. I'm trying to read branch data in from a text file.
myArgusever be non-null? Also: don't do this. Static state like this is almost always really really really bad idea (both in terms of isolation and thread-safety)