简体   繁体   中英

C++ Vector like class in C#

What is the analogous class of C++ std::vector in C#?

I want a class where it keeps an internal array inside and supports insertion at the back in O(1) time.

Here is a list with some C++ / C# containers that are roughly equivalent (not exact replacements) to each other:

  • std::list -> LinkedList ?
  • std::vector -> List ?

std::list is backed by array, each deletion would incur memory copy, same behavior as C# List. while C# LinkedList is backed by node list, same as std::vector.

so I believe below is correct.

  • std::list -> List
  • std::vector -> LinkedList

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM