public int CompareTo(object obj) { int result = 0; if (obj == null) { result = 1; } else { NuGenMenuFunctionShortcut otherShortcut = obj as NuGenMenuFunctionShortcut; if (otherShortcut != null) { result = MenuFunction.CompareTo(otherShortcut.MenuFunction); if (result == 0) { result = Shortcut.CompareTo(otherShortcut.Shortcut); } } else { throw new ArgumentException("Incorrect argument type: " + obj.GetType().FullName, "obj"); } } return(result); }