2021-08-05 19:48:27 +09:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ObservableCollections.Tests
|
|
|
|
|
{
|
2021-08-06 20:08:12 +09:00
|
|
|
|
public struct ViewContainer<T> : IEquatable<ViewContainer<T>>, IComparable<ViewContainer<T>>
|
2021-08-05 19:48:27 +09:00
|
|
|
|
{
|
|
|
|
|
public ViewContainer(T value)
|
|
|
|
|
{
|
|
|
|
|
Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public T Value { get; }
|
|
|
|
|
|
|
|
|
|
public static implicit operator ViewContainer<T>(T value) => new ViewContainer<T>(value);
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return Value.GetHashCode();
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-06 20:08:12 +09:00
|
|
|
|
public int CompareTo(ViewContainer<T> other)
|
2021-08-05 19:48:27 +09:00
|
|
|
|
{
|
2021-08-06 20:08:12 +09:00
|
|
|
|
return Comparer<T>.Default.Compare(Value, other.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Equals(ViewContainer<T> other)
|
|
|
|
|
{
|
|
|
|
|
return EqualityComparer<T>.Default.Equals(Value, other.Value);
|
2021-08-05 19:48:27 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|