Hi,
I have an application in which I have some general definitions that I need to use in different classes in the application.
What I did was create a class named Definitions, that looks like this, for example:
public class Definitions
{
public string id1;
public string id2;
.
.
.
}
I then wanted to define a variable of the type of this class, for example:
Definitions defs = new Definitions();
But I want this variable to be an array, so I wrote:
Definitions[] defs = new Definitions[10];
But when I used this array in a function it threw a NullReferenceException, saying: "Object reference not set to an instance of an object"...
I don't understand why this happens..
did I not define the array of type of the class correctly?
Is it not possible to define an array of type class?
Thanks for your help!
I have an application in which I have some general definitions that I need to use in different classes in the application.
What I did was create a class named Definitions, that looks like this, for example:
public class Definitions
{
public string id1;
public string id2;
.
.
.
}
I then wanted to define a variable of the type of this class, for example:
Definitions defs = new Definitions();
But I want this variable to be an array, so I wrote:
Definitions[] defs = new Definitions[10];
But when I used this array in a function it threw a NullReferenceException, saying: "Object reference not set to an instance of an object"...
I don't understand why this happens..
did I not define the array of type of the class correctly?
Is it not possible to define an array of type class?
Thanks for your help!