I have DataRow from grid and I need to modify few columns in one row. So I put all my columns in Array, and tried to modify them but it doesn't work as I wish. I need an explanation for that.
My goal is to get all columns in specific order in Array or some collection, and then modify them etc. I think I am now creating some new objects which reference to something else than my column. Maybe I should try to store in collection some references? Using ref should is best option?
DataRow dr = rows[i] as DataRow;
dr["size"] = 5000; // => size is 5000;
ChangeSize(dr); // => size is 6000;
ChangeSize body
private void ChangeSize(DataRow dataRow)
{
dataRow["size"] = 6000; // => size is 6000
Object[] arrayOfColumns= { dataRow["size"], ... };
arrayOfColumns[0] = 7000; // => won't change size...
}