Hi Vulpes,
I saw the following code you published on an answer and just wonder if you could explain it please bit by bit, I have put my answers below each line of code as to what I think...
Array temp = (Array)mySectionList.D;
// Creating a variable named temp of type Array which is cast to Array. Thinking mySectionList.D is a class with a static method?
double[] myDs = new double[temp.GetLength(0)];
// A new instance of type double with myDs as variable, temp is a field or property with GetLength which is derived from system.object?
for(int i = 1; i <= temp.GetLength(0); i++)
{
myDs[i - 1] = (float)temp.GetValue[i];
}
// a loop of which the integer 1 is less or equal to the GetLength arguement 0?
Regards,
Loading
VulpesPosted Apr 13, 2011, 2:43 PM
VulpesPosted Apr 14, 2011, 2:28 PM
Posted Apr 14, 2011, 2:19 PM
if (i == temp.getLength(0));
return i;
I dont understand why 1 would need to be looped, is it because mySectionList.D holds a 1-based array of floats which is what is being looped?
Regards,
VulpesPosted Apr 14, 2011, 2:11 PM
Also i is increased by one each time through the loop except the first time.
Posted Apr 14, 2011, 2:03 PM
VulpesPosted Apr 14, 2011, 1:59 PM
It starts off at 1 and is then incremented by 1 each time around the loop until it reaches temp.GetLength(0) and the loop terminates.
Posted Apr 14, 2011, 1:56 PM
In regards to the for loop, is it i or 1 that loops through the temp array?
Regards,
VulpesPosted Apr 13, 2011, 3:07 PM
Posted Apr 13, 2011, 2:59 PM
Many thanks for your answers there its really starting to fall into place for me now.
Unusual code in the sense that is not commonly practiced? - sorry for this, its just im trying to learn C# in depth! : )