Did you know System.Collections.Generic.List is implemented with an array? [closed]
I had a performance problem today that showed up after some profiling. Calls to List<>.RemoveAt(0) were taking a long time. I'd assumed System.Collections.Generic.开发者_如何学编程List would be implemented with a list data structure, but actually its implemented as an array.
Does anyone else find that surprising?
No. It's similar to the C++ standard std::vector type, as well as a generic replacement for the C# ArrayList type, which has "Array" in its name. If you want linked list behavior, use the LinkedList type.
精彩评论