protected int GetIndexBySort(T item) { if (comparer != null) { return(ListHelper.BinarySearch(items, item, comparer)); } return(Contains(item) ? IndexOf(item) : -(items.Count + 1)); }
protected int GetIndexForAdding(T item) { if (comparer != null) { var index = ListHelper.BinarySearch(items, item, comparer); return(CheckUnique ? index : -Math.Abs(index)); } return(CheckUnique ? Contains(item) ? IndexOf(item) : -(items.Count + 1) : -(items.Count + 1)); }