I think the method does not exist.
I decided with this:
public static string[] Sort(this string[] list, string start) { List<string> l = new List<string>(); l.AddRange(list.Where(p => p.StartsWith(start)).OrderBy(p => p)); l.AddRange(list.Where(p => !p.StartsWith(start)).OrderBy(p => p)); return l.ToArray(); }
So you can do
string[] list = new string[] { "Mark", "Tom", "Mat", "Mary", "Peter" }; string[] ordered_list = list.Sort("Ma");
If you need to order items with your own string and leave others unsorted, use this:
public static string[] Sort(this string[] list, string start) { List<string> l = new List<string>(); l.AddRange(list.Where(p => p.StartsWith(start)).OrderBy(p => p)); l.AddRange(list.Where(p => !p.StartsWith(start)));
Marco source share