Hello!
I have the code below. In the previous code not shown below I have used linq
to extract some row and
these have been placed in the var variable result. In my code there is just
one entry in result but it can be more.
All works fine the first time I enter the following foreach loop
foreach(var o in result)
{
o.ID = nextParamID.ToString();
o.WorksheetRowID = item.WorksheetRowID;
ccrFormObj.myWorksheetRowParameterList.Add(o);
nextParamID++;
}
but when I enter this same foreach loop the second time
the collection result is empy. How is that possible I haven't removed any
entry
in that collection.
My logic in the progam is to use this collection set result when I
enter this foreach loop
foreach(var o in result)
{
o.ID = nextParamID.ToString();
o.WorksheetRowID = item.WorksheetRowID;
ccrFormObj.myWorksheetRowParameterList.Add(o);
nextParamID++;
}
//Code start here
/////////////////////////
for (int i = 0; i < myParamRowCount; i++)
{
WorksheetRowParameter item = ccrFormObj.myWorksheetRowParameterList[i];
//If we have a change in the actual worksheetRowID we might have to do
something
if (item.WorksheetRowID != previousWorksheetRowID)
{
//Check if we have reached a parameter row that is the next
parameter initiator
//If true we have not reached this row so add parameter initiatorer
if (Convert.ToInt32(item.WorksheetRowID) <
workSheetIDListArray[index+1])
{
//We must add parameterinitiator rows because this procedure
require
//that parameter initiators must be repeated
//result is a worksheetRowParameter and contain all the
parameter initiatorer
//for the first row
foreach(var o in result)
{
o.ID = nextParamID.ToString();
o.WorksheetRowID = item.WorksheetRowID;
ccrFormObj.myWorksheetRowParameterList.Add(o);
nextParamID++;
}
}
}
previousWorksheetRowID = item.WorksheetRowID;
}
Can you give me some advice what I should do to keep this result as it is
without being cleaned.
//Tony