المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : I can not achieve if statement in my code



C# Programming
05-03-2011, 07:30 AM
HI,


I have arraylist and the first item in array represent time , the number of message in array may be reach up to 10,000 messages , so if I have messages reached to 2000 message the message number 20001 is set to 0 and when I try to get the total time I have problem because the total is the final element.


some issues :-

- if message set to zero after number of message I will consider the past time is 3640 seconds and so on.

total time = 3640 + the last element in the last in the next items.

- if number of message not set to zero the end item will represent the total time.



for (int j = 0; j < numberOfMessagesInSection; j++)
{

nextValue = int.Parse(MessageTimeAssociation[next + 1].messagebytes[0]);

if (nextValue >= int.Parse(MessageTimeAssociation[j].messagebytes[0]))
{
totalSectionTime = int.Parse(MessageTimeAssociation[numberOfMessagesInSection - 1].messagebytes[0]);

}
else
{

totalSectionTime += 3640;

}


this my code but my problems appears in this cases :-

if the arraylist contains few messages the total time should be the final element but this code not achieve it.