Resize Array By Last and not by First in C#
- by Leen15
Hi all!
I have an Array of Class elements, and by an int variable i need to resize this array to the last X elements.
So for example i have an array with:
Array[0] = Msg1
Array[1] = Msg2
Array[2] = Msg3
Array[3] = Msg4
Array[4] = Msg5
Array[5] = Msg6
Array[6] = Msg7
Array[7] = Msg8
Array[8] = Msg9
Array[9] = Msg10
and i need to have only the last 8 elements in the array.
i cannot use the Array.Resize function because the result would be:
Array[0] = Msg1
Array[1] = Msg2
Array[2] = Msg3
Array[3] = Msg4
Array[4] = Msg5
Array[5] = Msg6
Array[6] = Msg7
Array[7] = Msg8
and i need something like this:
Array[0] = Msg3
Array[1] = Msg4
Array[2] = Msg5
Array[3] = Msg6
Array[4] = Msg7
Array[5] = Msg8
Array[6] = Msg9
Array[7] = Msg10
How can i do this? i hope my problem is clear.
Thanks.