C# linq order by depending on Language

String[] a = new String[] { "NIKE", "한글","adidas","한글Korean" };

I like to order the array, the 한글 is first

if I just order without options. the English String is always on top.

how can I do this?


An overload of OrderBy takes an IComparer<string> and you can get one of these for a specific culture using the static Create method on StringComparer. Something like this should work:

CultureInfo ci = CultureInfo.GetCultureInfo("ko-KR"); 
bool ignoreCase = true; //whether comparison should be case-sensitive
StringComparer comp = StringComparer.Create(ci, ignoreCase);

string[] unordered = //whatever
var ordered = unordered.OrderBy(s => s, comp);

Need Your Help

MVC: How can I pass a list from one view to another?

asp.net-mvc ienumerable

I've got some data in a view that I would like to pass to a child partial view. Part of that data is a list of dates that I would like to display in the partial view. I'm pretty sure I can't pass an

How to Save and search content (made with wysiwyg html editor) in mysql database?

html mysql laravel-4 wysiwyg richtext

I want to use a wysiwyg html editor (like this) and save it to my mysql database.