I want to create an array containing all the Pushpin objects I am dealing with. While trying to populate the Array, I am getting a NullReferenceException Unhandled error thrown. I have read as much documentation as I can find and cannot work out what is going on.
I have tried at least the following:
Pushpin[] arrayPushpins;
int i = 0;
foreach (Result result in arrayResults)
{
Pushpin pin;
pin = new Pushpin();
pin.Location = d;
myMap.Children.Add(pin);
arrayPushpins[i] = new Pushpin();
arrayPushpins.SetValue(pin, i);;
i++;
}
AND...
Pushpin[] arrayPushpins;
int i = 0;
foreach (Result result in arrayResults)
{
Pushpin pin;
pin = new Pushpin();
pin.Location = d;
myMap.Children.Add(pin);
arrayPushpins[i] = new Pushpin();
arrayPushpins[i] = pin;
i++;
}
And nothing seems to work... I get the NullReference error every time. Any ideas? Many thanks! Will.