using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
string[] things= new string[] { "paul", "bob", "lauren", "007", "90", "101"};
foreach (var thing in things.OrderByDescending(x => x, new SemiNumericComparer()))
Console.WriteLine(thing);
public class SemiNumericComparer: IComparer<string>
public int Compare(string s1, string s2)
if (IsNumeric(s1) && IsNumeric(s2))
if (Convert.ToInt32(s1) > Convert.ToInt32(s2)) return 0;
if (Convert.ToInt32(s1) < Convert.ToInt32(s2)) return 1;
if (Convert.ToInt32(s1) == Convert.ToInt32(s2)) return -1;
if (IsNumeric(s1) && !IsNumeric(s2)){
if (!IsNumeric(s1) && IsNumeric(s2)){
return string.Compare(s1, s2, true);
public static bool IsNumeric(object value)
int i = Convert.ToInt32(value.ToString());
catch (FormatException) {