using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
List<object> list = new List<object>() { 3, "cat", 4.1, 'a', 5, "dog", "horse", 9.1, 'd', 1 };
list.Sort(new StringThenIntThenDoubleThenChar());
list.ForEach(x => Console.WriteLine(x));
public class StringThenIntThenDoubleThenChar : Comparer<object>
public override int Compare(object x, object y)
return GetTypeScore(x).CompareTo(GetTypeScore(y));
private int GetTypeScore(object o)
if (type == typeof(string)) return 0;
else if (type == typeof(int)) return 1;
else if (type == typeof(double)) return 2;
else if (type == typeof(char)) return 3;