foreach (DateTime op in Records.Keys)
{
CodeRecords[op].Records = new List
foreach (var Rec in FilteredList)
{
Row = new TempEvent();
Row.eIndex = ++Index;
Row.code = C.code;
Row.LSW = Rec.ELSW;
Row.MSW = Rec.EMSW;
Row.eValue = Rec.Data;
CodeRecords[op].Records.Add(Row);
if (Rec.code == "E000" && Rec.Data[0] == 'F')//End of operation
{
CodeRecords[op].EventCount = ++NumOfEvents;
NumOfEvents = 0;
Index = 0;
//I want to go back to the top of the first foreach and go to the next key and then go the second foreach
//and enumerate from where I left off from, I have a brain freeze at the moment whats the best way to this
}
else
{
++NumOfEvents;
}
}
}
David SmithPosted Nov 1, 2010, 2:29 PM
foreach (DateTime op in Records.Keys)
{
CodeRecords[op].Records = new List
foreach (var Rec in FilteredList)
{
Row = new TempEvent();
Row.eIndex = ++Index;
Row.code = C.code;
Row.LSW = Rec.ELSW;
Row.MSW = Rec.EMSW;
Row.eValue = Rec.Data;
CodeRecords[op].Records.Add(Row);
if (Rec.code == "E000" && Rec.Data[0] == 'F')//End of operation
{
CodeRecords[op].EventCount = ++NumOfEvents;
NumOfEvents = 0;
Index = 0;
}
else
{
++NumOfEvents;
}
}
}
David SmithPosted Nov 1, 2010, 10:00 AM
lets say I have a total of 10 rows in the second foreach,
and I breakout of the foreach at row 3, I have seven rows left,
the question is when i come back around to the second foreach, I want start from row 4, instead of row [0], thats the problem im having
David SmithPosted Nov 1, 2010, 9:05 AM
what I leave this case below can come back around to the second foreach its starts all over
if (Rec.code == "E000" && Rec.Data[0] == 'F')//End of operation
{
CodeRecords[op].EventCount = ++NumOfEvents;
NumOfEvents = 0;
Index = 0;
}
David SmithPosted Nov 1, 2010, 9:05 AM
what I leave this case below can come back around to the second foreach its starts all over
if (Rec.code == "E000" && Rec.Data[0] == 'F')//End of operation
{
CodeRecords[op].EventCount = ++NumOfEvents;
NumOfEvents = 0;
Index = 0;
}
Suthish NairPosted Nov 1, 2010, 5:54 AM
string Rec;
foreach (DateTime op in Records.Keys)
{
CodeRecords[op].Records = new List
foreach (Rec in FilteredList)
{ }
}
David SmithPosted Nov 1, 2010, 4:51 AM
if (Rec.code == "E000" && Rec.Data[0] == 'F')//End of operation te second foreach has 513 events, I cant make it pass the first 123 events because the second foreach
foreach (DateTime op in Records.Keys)
{
CodeRecords[op].Records = new List
foreach (var Rec in FilteredList)
{
if (EventRecords.Equals(EventRec))
{
continue;
}
Row = new TempEvent();
Row.eIndex = ++Index;
Row.code = C.code;
Row.LSW = Rec.ELSW;
Row.MSW = Rec.EMSW;
Row.eValue = Rec.Data;
CodeRecords[op].Records.Add(Row);
if (Rec.code == "E000" && Rec.Data[0] == 'F')//End of operation
{
CodeRecords[op].EventCount = ++NumOfEvents;
NumOfEvents = 0;
Index = 0;
break;
}
else
{
++NumOfEvents;
}
}
}
David SmithPosted Nov 1, 2010, 4:20 AM
Suthish NairPosted Nov 1, 2010, 3:54 AM
first for-each
second for-each
foreach(Rec in ...)
David SmithPosted Nov 1, 2010, 3:40 AM
David SmithPosted Nov 1, 2010, 3:37 AM
so if it come back to the second foreach its going to start all back over, how to remember the last location and start from that point
David SmithPosted Nov 1, 2010, 3:20 AM
Manikavelu VelayuthamPosted Nov 1, 2010, 3:12 AM
It will break the current for loop and move the cursor over to the first foreach loop.
Hope that will solve your problem