Copy an array backwards? Array.Copy?

Posted by daniel on Stack Overflow See other posts from Stack Overflow or by daniel
Published on 2010-04-26T02:56:50Z Indexed on 2010/04/26 3:03 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

I have a List<T> that I want to be able to copy to an array backwards, meaning start from List.Count and copy maybe 5 items starting at the end of the list and working its way backwards. I could do this with a simple reverse for loop; however there is probably a faster/more efficient way of doing this so I thought I should ask. Can I use Array.Copy somehow?

Originally I was using a Queue as that pops it off in the correct order I need, but I now need to pop off multiple items at once into an array and I thought a list would be faster.

© Stack Overflow or respective owner

Related posts about c#

Related posts about array