what is the difference between arrays,vectors and lists?
and what are the different use cases
14 Replies
generally arrays are fixed in size, cannot be grown or shrunk
list and vector are resizable, and are usually the same thing conceptually
some languages like Rust and C++ use the term Vector, others like Java, Python, C# use the term List
cant arrays be set in variable size?
well, are you talking about arrays in .NET specifically, or arrays in general?
in general
also what do you mean "variable size"?
like you can do
new int[mySize];
but the array will always be mySize
in length, can't be grown lateryep
yeah that's just fine
are list and vector mutable/dynamic?
they're all mutable, as far as C# is concerned the difference between an array and list is a list dynamically resizes to hold more items
there's no collection in C# called a vector
There kind of is, but it refers to the mathematical term "vector", not what C++ or Rust mean by the word
Isn't English fun?
Like the 2d matrix stuff?
Yes