I'm trying to sort a List of SelectListItem with LINQ with no success.
For Each item In query
brandCategoryList.Add(New SelectListItem With {
.Text = FriendlyCategory(item),
.Value = item
})
Next
brandCategoryList.OrderBy(Function(m) m.Text)
What am I doing wrong? The results are returned in original order as if the OrderBy function was not called. Thanks in advance!
You can edit the list in place with Sort()
brandCategoryList.Sort(Function(a, b) a.Text < b.Text)