Struct ElementIndex<T>
Represents an element from an observable sequence associated with its index information. The zero-based index represents the order of the element in the sequence.
public struct ElementIndex<T> : IEquatable<ElementIndex<T>>
Type Parameters
T
The type of the value being annotated with index information.
- Implements
- Inherited Members
Constructors
ElementIndex(T, int)
Initializes a new instance of the ElementIndex<T> class with the specified value and index information.
public ElementIndex(T value, int index)
Parameters
value
TThe value to be annotated with index information.
index
intThe zero-based index of the element in the sequence.
Properties
Index
Gets the zero-based index of the element in the sequence.
public int Index { get; }
Property Value
Value
Gets the value of the element.
public T Value { get; }
Property Value
- T
Methods
Equals(ElementIndex<T>)
Returns a value indicating whether this instance has the same value and index as a specified ElementIndex<T> structure.
public bool Equals(ElementIndex<T> other)
Parameters
other
ElementIndex<T>The ElementIndex<T> structure to compare to this instance.
Returns
Equals(object)
Tests to see whether the specified object is an ElementIndex<T> structure with the same value and index as this ElementIndex<T> structure.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with this instance.
Returns
- bool
true if
obj
is an ElementIndex<T> and has the same value and index as this ElementIndex<T>; otherwise, false.
GetHashCode()
Returns a hash code for the current instance.
public override int GetHashCode()
Returns
- int
The hash code for the current instance.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(ElementIndex<T>, ElementIndex<T>)
Tests whether two ElementIndex<T> structures are equal.
public static bool operator ==(ElementIndex<T> left, ElementIndex<T> right)
Parameters
left
ElementIndex<T>The ElementIndex<T> structure on the left-hand side of the equality operator.
right
ElementIndex<T>The ElementIndex<T> structure on the right-hand side of the equality operator.
Returns
operator !=(ElementIndex<T>, ElementIndex<T>)
Tests whether two ElementIndex<T> structures are different.
public static bool operator !=(ElementIndex<T> left, ElementIndex<T> right)
Parameters
left
ElementIndex<T>The ElementIndex<T> structure on the left-hand side of the inequality operator.
right
ElementIndex<T>The ElementIndex<T> structure on the right-hand side of the inequality operator.