c# - Sorting IEnumerable<SelectListItem> by Text field -


i don't know if i'm doing wrong here, can't sorted list when using:

public static ienumerable<selectlistitem> toselectlist<tenumerable>(     ienumerable<tenumerable> enumerable,     func<tenumerable, int> value,     func<tenumerable, string> text) {     return enumerable.select(         item => new selectlistitem         {             value = value(item).tostring(cultureinfo.invariantculture),             text = text(item)         }).orderby(sli => sli.text); } 

but when using following, list ordered 'value' field without issues:

    return enumerable.select(         item => new selectlistitem         {             value = value(item).tostring(cultureinfo.invariantculture),             text = text(item)         }).orderby(sli => sli.value); 

i list sorted 'text' field. appreciated.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -