C # containers - vector ,. list, queue, stack, etc.

From similar headers, I can see that they are probably not available in C #. because they are so basic and useful that they should be there, but are probably called something else.

In case they are available, they support sort / search / insert / delete / unique, etc. - conventional algorithms?

+6
source share
4 answers

You are looking for classes in System.Collections.Generic , as well as LINQ to Objects.

+9
source

Names, for the most part, suggest that they were.

From MSDN:

System.Collections.Generic namespace :

Since they all implement the common IEnumerable interface , you can use the extension methods from the Enumerated class with them, including OrderBy / OrderByDescending ("sort") and Distinct ("unique"). Each of the three classes provides its own special methods for adding and removing items from the collection.

+3
source

They are available, and what else do they support AWESOMENESS Linq. This allows you to do a lot more cooler than just the basic algorithms that you will find in the std C ++ library.

+2
source

In .NET 4.0 you have

 System.Collections.Generic.Stack<T> System.Collections.Generic.Queue<T> 

and many others.

For general operations on these collection classes, add Using System.Linq; to your C # code.

0
source

Source: https://habr.com/ru/post/902604/


All Articles