Well I encounter many situations where having an IEnumerable is not enough. However I'm unsure about the performance of the above method calls.
What I really want to ask is:
Is the performance of ToList/ToArray:
- an O(n) operation which copies the IEnumerable to a new array/List ?
If I called a linq extention method on a list, it has an O(1) performance if I call ToList but O(n) if call ToArray (and the opposite if my original list was an array) ?
Some magic happens and the performance is O(1)?
Probably to Dictionary is O(n), right ?