Struct ItemChange<T>
- Namespace
- DynamicData
- Assembly
- DynamicData.dll
Container to describe a single change to a cache.
public readonly struct ItemChange<T> : IEquatable<ItemChange<T>> where T : notnull
Type Parameters
T
The type of the item.
- Implements
-
IEquatable<ItemChange<T>>
Constructors
ItemChange(ListChangeReason, T, in Optional<T>, int, int)
Initializes a new instance of the ItemChange<T> struct.
public ItemChange(ListChangeReason reason, T current, in Optional<T> previous, int currentIndex = -1, int previousIndex = -1)
Parameters
reason
ListChangeReasonThe reason.
current
TThe current.
previous
Optional<T>The previous.
currentIndex
intValue of the current.
previousIndex
intValue of the previous.
ItemChange(ListChangeReason, T, int)
Initializes a new instance of the ItemChange<T> struct.
public ItemChange(ListChangeReason reason, T current, int currentIndex)
Parameters
reason
ListChangeReasonThe reason.
current
TThe current.
currentIndex
intIndex of the current.
Fields
Empty
An empty change.
public static readonly ItemChange<T> Empty
Field Value
- ItemChange<T>
Properties
Current
Gets the item which has changed.
public T Current { get; }
Property Value
- T
CurrentIndex
Gets the current index.
public int CurrentIndex { get; }
Property Value
Previous
Gets the previous change.
This is only when Reason==ChangeReason.Replace.
public Optional<T> Previous { get; }
Property Value
- Optional<T>
PreviousIndex
Gets the previous index.
This is only when Reason==ChangeReason.Replace or ChangeReason.Move.
public int PreviousIndex { get; }
Property Value
Reason
Gets the reason for the change.
public ListChangeReason Reason { get; }
Property Value
Methods
Equals(ItemChange<T>)
Determines whether the specified object, is equal to this instance.
public bool Equals(ItemChange<T> other)
Parameters
other
ItemChange<T>The other.
Returns
- bool
If the value is equal.
Equals(object?)
Determines whether the specified object, is equal to this instance.
public override bool Equals(object? obj)
Parameters
Returns
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
Operators
operator ==(in ItemChange<T>, in ItemChange<T>)
Determines whether the specified objects are equal.
public static bool operator ==(in ItemChange<T> left, in ItemChange<T> right)
Parameters
left
ItemChange<T>The left hand side to compare.
right
ItemChange<T>The right hand side to compare.
Returns
- bool
If the two values are equal.
operator !=(in ItemChange<T>, in ItemChange<T>)
Determines whether the specified objects are not equal.
public static bool operator !=(in ItemChange<T> left, in ItemChange<T> right)
Parameters
left
ItemChange<T>The left hand side to compare.
right
ItemChange<T>The right hand side to compare.
Returns
- bool
If the two values are not equal.