How can i add orderby to this:
return (from m in response["holder"].Children()
orderby m["name"]
select new SelectListItem
{
Text = m["name"].ToString(),
Value = m["name"].ToString()
}).ToList();
The problem is that the json returned in the response variable has a list of names, all of them have an uppercase first letter apart from one so they all get ordered fine except the one with the lower case which gets stuck at the bottom of the SelectListItem list.
Any ideas?
Thanks in advance..
EDIT:
Additional info – i am using JSON.NET to parse the json response. And the response variable is a JObject.
You’ll need to normalize the data during your
orderby. In my example I’ve chosen to use theToUpperInvariant()method:I’m also assuming that
m["name"]is already aStringobject. If it’s not, change the line to: