My program intensively uses Reverse
, e.g. Array.Reverse(myArray,3,5)
I would like my program could accept both array
and List
as input, so I go for IList
However, I couldn't find an IList
method which is the same as Reverse
.
There is one extension method named Reverse
, however it produces IEnumerable
stream but not in-place rearrangement. (which I assume takes more copy time)
I thought of using cast
, but was afraid that cast
would be inefficient as well.
So, what should I do?
Worst case scenario, I make 2 program, 1 takes array, the other takes List, and then overloading?