Grouping a list by the last Char

alt text http://barbarosalp.com/questions/list.png

Hello,

As you can see in the picture above, I have a list of "keys" filled with Request.Form.AllKeys, the key of which starts with "txt".

I want to group them by their last id like

[0] "txtTitle:2" "txtDescription:2"
[1] "txtTitle:3" "txtDescription:3"

      

How can I achieve this with a lambda expression.

Many thanks

0


source to share


1 answer


var groups = keys.GroupBy(e=>e.Split(':').Last());

      



+3


source







All Articles