@@ -42,9 +42,18 @@ public ObservableCollection(List<T> list)
4242 public void Move ( int oldIndex , int newIndex ) => MoveItem ( oldIndex , newIndex ) ;
4343
4444 /// <summary>
45- /// Binary search on a sorted collection. Returns the index of the item if found,
46- /// or the bitwise complement (~index) of the insertion point if not found.
45+ /// Performs a binary search on a sorted collection.
46+ /// The collection must already be sorted according to <paramref name="comparer"/>
47+ /// (or <see cref="Comparer{T}.Default"/> when <c>null</c>).
4748 /// </summary>
49+ /// <param name="item">The item to search for.</param>
50+ /// <param name="comparer">
51+ /// The comparer to use. When <c>null</c>, <see cref="Comparer{T}.Default"/> is used.
52+ /// </param>
53+ /// <returns>
54+ /// The zero-based index of <paramref name="item"/> if found;
55+ /// otherwise, the bitwise complement (<c>~index</c>) of the insertion point.
56+ /// </returns>
4857 public int BinarySearch ( T item , IComparer < T > ? comparer = null )
4958 {
5059 comparer ??= Comparer < T > . Default ;
@@ -62,8 +71,13 @@ public int BinarySearch(T item, IComparer<T>? comparer = null)
6271
6372 /// <summary>
6473 /// Inserts an item into the collection maintaining sorted order.
65- /// Uses binary search to find the correct insertion point.
74+ /// Uses <see cref="BinarySearch"/> to find the correct insertion point
75+ /// and raises <see cref="CollectionChanged"/>.
6676 /// </summary>
77+ /// <param name="item">The item to insert.</param>
78+ /// <param name="comparer">
79+ /// The comparer to use. When <c>null</c>, <see cref="Comparer{T}.Default"/> is used.
80+ /// </param>
6781 public void InsertSorted ( T item , IComparer < T > ? comparer = null )
6882 {
6983 int index = BinarySearch ( item , comparer ) ;
0 commit comments