Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a C# list like a C++ list?

Im just wondering if a C# List is like a C++ List.

Removing an element in the middle of a big list in C++ is fast because i know the elements are just pointing to the next.

So when removing a element in the middle of a big C# list, is that the same as in C++? Or is the C# list more like a C++ vector with indexes because you can get the index number of the elements in the C# list.

like image 657
Assassinbeast Avatar asked Jun 09 '13 20:06

Assassinbeast


1 Answers

  • C# List<T> is analogous to, and has the same performance characteristics, as C++ vector<T>.
  • C# LinkedList<T> is analagous to, and has the same performance characteristics, as C++ list<T>.

The performance characteristics are discussed in some detail in the remarks sections of the relevant sections of the .net documentation: List<T>, LinkedList<T>.

like image 95
David Heffernan Avatar answered Sep 19 '22 23:09

David Heffernan