I have a list that contains strings. How can I sort items in this list by length?
For example, before sorting:
list[0] = "my friend"; list[1] = "Hello"; After sorting:
list[0] = "Hello"; list[1] = "my friend"; Source: https://ru.stackoverflow.com/questions/612936/
All Articles
Sortwrapper function of theListsupports a sorting function in which the desired sort condition is written. Open msdn - look. - nick_n_alinqlike so:result = list.OrderBy(x=>x.Length)- Bald