views:

59

answers:

1

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?

A: 

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.

MikeP