Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/DynamicData/Cache/Change.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Change(ChangeReason reason, TKey key, TObject current, int index = -1)

/// <summary>
/// Initializes a new instance of the <see cref="Change{TObject, TKey}"/> struct.
/// Constructor for ChangeReason.Move.
/// Constructor for <see cref="ChangeReason.Moved"/>.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="current">The current.</param>
Expand Down Expand Up @@ -70,9 +70,9 @@ public Change(TKey key, TObject current, int currentIndex, int previousIndex)
/// <param name="currentIndex">Value of the current.</param>
/// <param name="previousIndex">Value of the previous.</param>
/// <exception cref="ArgumentException">
/// For ChangeReason.Add, a previous value cannot be specified
/// For <see cref="ChangeReason.Add"/>, a previous value cannot be specified
/// or
/// For ChangeReason.Change, must supply previous value.
/// For <see cref="ChangeReason.Update"/>, must supply previous value.
/// </exception>
public Change(ChangeReason reason, TKey key, TObject current, in Optional<TObject> previous, int currentIndex = -1, int previousIndex = -1)
: this()
Expand All @@ -91,7 +91,7 @@ public Change(ChangeReason reason, TKey key, TObject current, in Optional<TObjec

if (reason == ChangeReason.Update && !previous.HasValue)
{
throw new ArgumentException("For ChangeReason.Change, must supply previous value");
throw new ArgumentException("For ChangeReason.Update, must supply previous value");
}
}

Expand All @@ -101,7 +101,7 @@ public Change(ChangeReason reason, TKey key, TObject current, in Optional<TObjec
public TKey Key { get; }

/// <summary>
/// Gets the reason for the change.
/// Gets the reason for the change.
/// </summary>
public ChangeReason Reason { get; }

Expand All @@ -116,14 +116,14 @@ public Change(ChangeReason reason, TKey key, TObject current, in Optional<TObjec
public int CurrentIndex { get; }

/// <summary>
/// <para>Gets the previous change.</para>
/// <para>This is only when Reason==ChangeReason.Replace.</para>
/// <para>Gets the item from before the change.</para>
/// <para>This is only when <see cref="Reason"/> is <see cref="ChangeReason.Update"/>.</para>
/// </summary>
public Optional<TObject> Previous { get; }

/// <summary>
/// <para>Gets the previous change.</para>
/// <para>This is only when Reason==ChangeReason.Update or ChangeReason.Move.</para>
/// <para>Gets the previous index.</para>
/// <para>This is only when <see cref="Reason"/> is <see cref="ChangeReason.Update"/> or <see cref="ChangeReason.Moved"/>.</para>
/// </summary>
public int PreviousIndex { get; }

Expand Down
14 changes: 8 additions & 6 deletions src/DynamicData/List/Change.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Change(ListChangeReason reason, IEnumerable<T> items, int index = -1)

/// <summary>
/// Initializes a new instance of the <see cref="Change{T}"/> class.
/// Constructor for ChangeReason.Move.
/// Constructor for <see cref="ListChangeReason.Moved"/>.
/// </summary>
/// <param name="current">The current.</param>
/// <param name="currentIndex">The CurrentIndex.</param>
Expand Down Expand Up @@ -84,25 +84,27 @@ public Change(T current, int currentIndex, int previousIndex)
/// <param name="currentIndex">Value of the current.</param>
/// <param name="previousIndex">Value of the previous.</param>
/// <exception cref="ArgumentException">
/// For ChangeReason.Add, a previous value cannot be specified
/// For <see cref="ListChangeReason.Add"/>, a previous value cannot be specified
/// or
/// For ChangeReason.Change, must supply previous value.
/// For <see cref="ListChangeReason.Replace"/>, must supply previous value.
/// or
/// For <see cref="ListChangeReason.Refresh"/>, must supply an index.
/// </exception>
public Change(ListChangeReason reason, T current, in Optional<T> previous, int currentIndex = -1, int previousIndex = -1)
{
if (reason == ListChangeReason.Add && previous.HasValue)
{
throw new ArgumentException("For ChangeReason.Add, a previous value cannot be specified");
throw new ArgumentException("For ListChangeReason.Add, a previous value cannot be specified");
}

if (reason == ListChangeReason.Replace && !previous.HasValue)
{
throw new ArgumentException("For ChangeReason.Replace, must supply previous value");
throw new ArgumentException("For ListChangeReason.Replace, must supply previous value");
}

if (reason == ListChangeReason.Refresh && currentIndex < 0)
{
throw new ArgumentException("For ChangeReason.Refresh, must supply an index");
throw new ArgumentException("For ListChangeReason.Refresh, must supply an index");
}

Reason = reason;
Expand Down
6 changes: 3 additions & 3 deletions src/DynamicData/List/ItemChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ public ItemChange(ListChangeReason reason, T current, int currentIndex)
public int CurrentIndex { get; }

/// <summary>
/// <para>Gets the previous change.</para>
/// <para>This is only when Reason==ChangeReason.Replace.</para>
/// <para>Gets the item from before the change.</para>
/// <para>This is only when <see cref="Reason"/> is <see cref="ListChangeReason.Replace"/>.</para>
/// </summary>
public Optional<T> Previous { get; }

/// <summary>
/// <para>Gets the previous index.</para>
/// <para>This is only when Reason==ChangeReason.Replace or ChangeReason.Move.</para>
/// <para>This is only when <see cref="Reason"/> is <see cref="ListChangeReason.Replace"/> or <see cref="ListChangeReason.Moved"/>.</para>
/// </summary>
public int PreviousIndex { get; }

Expand Down
2 changes: 1 addition & 1 deletion src/DynamicData/List/RangeChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private RangeChange()
public IEnumerator<T> GetEnumerator() => _items.GetEnumerator();

/// <summary>
/// Inserts the item in the range at the specified index.
/// Inserts the item in the range at the specified index.
/// </summary>
/// <param name="index">The index.</param>
/// <param name="item">The item.</param>
Expand Down
Loading