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;
}
}
}

Manikavelu VelayuthamRank #413 · 6K reputationPosted Oct 31, 2010, 11:12 PM EDT
It will break the current for loop and move the cursor over to the first foreach loop.
Hope that will solve your problem
David SmithRank #999 · 2K reputationPosted Oct 31, 2010, 11:20 PM EDT
David SmithRank #999 · 2K reputationPosted Oct 31, 2010, 11:37 PM EDT
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 SmithRank #999 · 2K reputationPosted Oct 31, 2010, 11:40 PM EDT
Suthish NairRank #92 · 22.8K reputationPosted Oct 31, 2010, 11:54 PM EDT
first for-each
second for-each
foreach(Rec in ...)
David SmithRank #999 · 2K reputationPosted Nov 1, 2010, 12:20 AM EDT
David SmithRank #999 · 2K reputationPosted Nov 1, 2010, 12:51 AM EDT
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;
}
}
}
Suthish NairRank #92 · 22.8K reputationPosted Nov 1, 2010, 1:54 AM EDT
string Rec;
foreach (DateTime op in Records.Keys)
{
CodeRecords[op].Records = new List
foreach (Rec in FilteredList)
{ }
}
David SmithRank #999 · 2K reputationPosted Nov 1, 2010, 5:05 AM EDT
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 SmithRank #999 · 2K reputationPosted Nov 1, 2010, 5:05 AM EDT
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 SmithRank #999 · 2K reputationPosted Nov 1, 2010, 6:00 AM EDT
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 SmithRank #999 · 2K reputationPosted Nov 1, 2010, 10:29 AM EDT
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;
}
}
}