最佳答案
Consider the following common JavaScript construct
var ages = people.map(person => person.age);
Giving the desired result, which is an array of ages.
What is the equivalent of this in C#? Please include a simple example. The documentation indicates select
or possible selectAll
but I can't find an example online or any other SO question which can be pasted in and works.
If possible, give an example which turns the following array {1,2,3,4}
into the following {'1a','2a','3a','4a'}
. For each element, append "a" to the end, turning it from an Integer to a String.