A
A
Alexey Smirnov2017-02-18 21:04:16
.NET
Alexey Smirnov, 2017-02-18 21:04:16

How to extract a column from a 2D List to a 1D List?

There is some two-dimensional dynamic list List:

List<List<int>> twoDimentionalList = new List<List<int>>();

In which there are 3 columns and 100 rows filled with data (if I express myself correctly).
How to extract all elements of the 2nd column from this two-dimensional list and write them into a one-dimensional dynamic list List?
.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Pavlov, 2017-02-18
@ERAFY

List<int> allIntegersFromSecondColumn = twoDimentionalList.Select(row => row[1]).ToList();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question