static int CompareTasksSortFunc(Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b) { ITask taskA = model.GetValue(a, 0) as ITask; ITask taskB = model.GetValue(b, 0) as ITask; if (taskA == null || taskB == null) { return(0); } return(taskA.CompareTo(taskB)); }