/// <summary> /// Compare! /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public override int Compare(object x, object y) { string x1 = null; if (col < ((ListViewItem)x).SubItems.Count) x1 = ((ListViewItem)x).SubItems[col].Text; string y1 = null; if(col < ((ListViewItem)y).SubItems.Count) y1 = ((ListViewItem)y).SubItems[col].Text; if (comparer == null) { // Default is the StringComparer ISortComparer c = new StringComparer(); c.SortOrder = sortorder; return c.Compare(x1, y1); } else { comparer.SortOrder = sortorder; return comparer.Compare(x1, y1); } }