I have a list and I need to update some of the data in this list.
I have a update T-SQL query:
Update Report
Set ['+@Period+'] = @Amount
Where Group = 1
I think that I can use foreach for this update.
string period=startDate.ToString("yy/MM/dd").Substring(0, 2) + startDate.ToString("yy/MM/dd").Substring(3, 2);
foreach (var item in report)
{
if (item.Grup == 1)
{
item.??? = amount; //My period names in the table like _2101, _2102 etc
}
}
I use foreach because I have a while condition outside of the foreach and the update operation will occur for other periods. How can I get the item.period?
--Edit--
My table looks like that and I want to update null values one by one. This method returns the report table.

item.period.itemso that you can iterate over it. Hard to tell without seeing whatitemactually looks like.periodproperty of every item variable?" - I would agree with Robert but hard to say without you adding more information.