Hi guys,
I'm reusing a created Object just to change a Date and the ordinal value, but at the end I get 6 objects exactly as the last.
in other words, I'm adding the object as a Reference and I should add as a Value
What should I inherit my Object to have the Copy()
method ?
RecurringPayment rp, copy;
rp = new RecurringPayment
{
...
}
payments.Add(rp); // add first object
copy = rp; // Copy the original element
for (int i = 1; i <= 5; i++)
{
copy.NextPaymentDate = copy.NextPaymentDate.AddDays(copy.RecurringTime * 7);
copy.OrderOrdinal = copy.OrderOrdinal + 1;
payments.Add(copy); // add 5 more with X weeks ahead
}
Thank you