Skip to content

Commit 5591c2d

Browse files
rafalmaciagclaude
andcommitted
Enable XML doc generation and add docs to BinarySearch/InsertSorted
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1762244 commit 5591c2d

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

Source/ModelingEvolution.Observable/ModelingEvolution.Observable.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<PackageDescription>Minimal classes for Observable</PackageDescription>
1414
<PackageReadmeFile>README.md</PackageReadmeFile>
1515
<RepositoryUrl>https://github.com/modelingevolution/observable</RepositoryUrl>
16-
<GenerateDocumentationFile>False</GenerateDocumentationFile>
16+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
1717
<Copyright>ModelingEvolution</Copyright>
1818
<Authors>ModelingEvolution Team</Authors>
1919
</PropertyGroup>

Source/ModelingEvolution.Observable/ObservableCollection.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)