public void Method1() { for (int i = 0; i < Count; i++) { OuterObject.InnerList[i].X = 0.0; OuterObject.InnerList[i].Y = 5.0 + i; OuterObject.InnerList[i].Z = Math.Sin(i); //... } } public void Method2() { for (int i = 0; i < Count; i++) { // Assign a local variable, which is a reference // on the item class, having X,Y,Z double properties. var item = OuterObject.InnerList[i]; item.X = 0.0; item.Y = 5.0 + i; item.Z = Math.Sin(i); //... } }
item
OuterObject.InnerList[i]
OuterObject
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)