null reference error??? help please
hey guys
I am getting the error
An unhandled exception of type 'System.NullReferenceException' occurred in Testharness.exe
Additional information: Object reference not set to an instance of an object.
--------------------------------------------------------
namespace AdaptorPropertyNamespace
{
public class AdaptorProperty
{
public string propertyName;
public string propertyStringValue;
}
}
---------------------------------------------------------
AdaptorProperty[] properties = new AdaptorProperty[2];
properties[0].propertyName = "title";
----------------------------------------------------------
why does my program break out at 'properties[0].propertyName = "title";' with a null reference error?
thanx in advance
Re: null reference error??? help please
Code:
AdaptorProperty[] properites = new AdaptorProperty[2];
properites[0] = new AdaptorProperty();
properites[0].propertyName = "TITLE";
Because you'd declared the arrays, but not the objects themselves.
Re: null reference error??? help please
Sorry about the spelling.