Repository navigation
Expand file tree
/
Copy pathPagedChangeSet.cs
More file actions
59 lines (50 loc) · 1.88 KB
/
Copy pathPagedChangeSet.cs
File metadata and controls
59 lines (50 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.Collections.Generic;
using System.Linq;
using DynamicData.Operators;
namespace DynamicData
{
internal sealed class PagedChangeSet<TObject, TKey> : ChangeSet<TObject, TKey>, IPagedChangeSet<TObject, TKey>
{
public PagedChangeSet(IKeyValueCollection<TObject, TKey> sortedItems, IEnumerable<Change<TObject, TKey>> updates, IPageResponse response)
: base(updates)
{
Response = response;
SortedItems = sortedItems;
}
public IKeyValueCollection<TObject, TKey> SortedItems { get; }
public IPageResponse Response { get; }
#region Equality Members
/// <summary>
/// Equalses the specified other.
/// </summary>
/// <param name="other">The other.</param>
/// <returns></returns>
public bool Equals(PagedChangeSet<TObject, TKey> other)
{
return SortedItems.SequenceEqual(other.SortedItems);
// return Equals(this.SortedItems, other.SortedItems);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((PagedChangeSet<TObject, TKey>)obj);
}
public override int GetHashCode()
{
return SortedItems?.GetHashCode() ?? 0;
}
#endregion
/// <summary>
/// Returns a <see cref="T:System.String"/> that represents the SortedItems <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> that represents the SortedItems <see cref="T:System.Object"/>.
/// </returns>
public override string ToString()
{
return string.Format("{0}, Response: {1}, SortedItems: {2}", base.ToString(), Response, SortedItems);
}
}
}