I have a dicionary of strings and dates
private readonly Dictionary<string, DateTime>
as a private member variable in a class
I have methods which recursively get the next and previous value in the dictionary given a particular key
e.g.
It takes the given key, does a database lookup, if that is null, it gets the next one and so on recursively. It does this both forward and backwards
I have used this to get the next one
Find next record in a set: LINQ
My question is can I simply add Reverse to the linq statement to do this backwards?
Obviously it will work but I am worried about the state it will leave my member variable list in
i.e. will it be reversed? or is a copy have made when doing the reverse?
thanks
Enumerable.Reversedoes not mutate the sequence on which it is invoked.