I have a class that only has public automatic properties of strings
like Name, ID, LastName and also I have defiend a constructor for it and defiend them as string.Empty
too.
Now in the code I create an array of this class like this:
AlternateAddressSummary[] alternateAddressSummaries = new AlternateAddressSummary[6];
int adrsCounter = -1;
foreach (Addresses adrs in address_alternative)
{
adrsCounter++;
FillAlternateAddressSummaryObject(alternateAddressSummaries[adrsCounter], adrs);
}
And FillAlternateAddressSummaryObject
is just filling the properties of each object for example:
private void FillAlternateAddressSummaryObject(AlternateAddressSummary alA, Addresses adrs)
{
alA.AlternateAdressLine1 = adrs.City;
//...
}
But why do I get NULL
exception on alA
? Even when I create those 6 array objects, they are initialized to NULL
. Shouldn't they be set to what I say in the constructor
?