hi all, first post so pls dont be hard with me :p
well i have this code and i dont know why it says error pls check it :
double total = 0.0;
int size = _receipt.Count;
for (int i = 0; i <= size; i++)
{
if ((Receipt)_rece ipt[i] is ItInvoices) //the ERROR is in this line
{
ItInvoices itinvoi = (ItInvoices)_re ceipt[i];
total = total + itinvoi.getNeto ();
}
else
{
Ticket tick = (Ticket)_receip t[i];
total = total + tick.getNeto();
}
Console.WriteLi ne(total);
}
the ERROR says: The index was outside the interval. It must be a nonnegative and inferior value to the size of the collection. Name of the parameter: index
well i have this code and i dont know why it says error pls check it :
double total = 0.0;
int size = _receipt.Count;
for (int i = 0; i <= size; i++)
{
if ((Receipt)_rece ipt[i] is ItInvoices) //the ERROR is in this line
{
ItInvoices itinvoi = (ItInvoices)_re ceipt[i];
total = total + itinvoi.getNeto ();
}
else
{
Ticket tick = (Ticket)_receip t[i];
total = total + tick.getNeto();
}
Console.WriteLi ne(total);
}
the ERROR says: The index was outside the interval. It must be a nonnegative and inferior value to the size of the collection. Name of the parameter: index
Comment