F# List.map equivalent in C#?

后端 未结 2 1065
借酒劲吻你
借酒劲吻你 2021-02-06 19:58

Is there an equivalent to F#\'s List.map function in C#? i.e. apply a function to each element in the list and return a new list containing the results.

Something like:<

2条回答
  •  死守一世寂寞
    2021-02-06 20:36

    That is LINQ's Select - i.e.

    var newSequence = originalSequence.Select(x => {translation});
    

    or

    var newSequence = from x in originalSequence
                      select {translation};
    

提交回复
热议问题