Firstly thank you for taking the time to look at my question.
I have a csv file of letters for which i need to get the last letter of the array and move it to the start while "pushing" the other letters across
E.G.
--Source-- a,b,c,d,[e]
--Rotated-- e,a,b,c,d
for (var i = 0; i < Array.Length - 1; i++)
{
temp = Array[Array.Length];
Array[Array.Length] = Array[Array.Length - 1];
Array[i + 1] = Array[i];
Array[i] = temp;
}
For this I am aware that not all characters would be effected but i cant think of a loop to get all values moved
Array.Length. The last index is 1 less than that. Think of the logic first - write it down if you have to - and then write code to implement that logic. First, put the last element in a temporary location. Then go from the second last element to the first, moving each element to the next index. Finally, move the temp value into the first element. So, you've got code inside the loop that belongs outside, your indexing is wrong and your loop is backwards.