David Smith

David Smith

  • NA
  • 2k
  • 0

foreach help

Nov 1 2010 3:06 AM
review the comments in red below

foreach (DateTime op in Records.Keys)
      {
        CodeRecords[op].Records = new List<TempCodes>();
        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;
          }
        }
      }

Answers (12)