Is there anyway to foreach through a list from the end to the beginning rather than the beginning to then end (preferably without reordering the list).
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit: There is one more step if you are dealing specifically with a
List<T>. That class defines its ownReversemethod whose signature is not the same as theEnumerable.Reverseextension method. In that case, you need to “lift” the variable reference toIEnumerable<T>: