Class ItemPositionPair<TItem>
Item-location pair denoting an entry in a spatial map.
Inheritance
ItemPositionPair<TItem>
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class ItemPositionPair<TItem> : ValueType, IEquatable<ItemPositionPair<TItem>>, IMatchable<ItemPositionPair<TItem>>
Type Parameters
Name |
Description |
TItem |
The type of item stored in the pairing.
|
Constructors
ItemPositionPair(TItem, Point)
Declaration
public ItemPositionPair(TItem item, Point position)
Parameters
Type |
Name |
Description |
TItem |
item |
|
Point |
position |
|
Fields
Item
Declaration
public readonly TItem Item
Field Value
Position
The position the item is located at.
Declaration
public readonly Point Position
Field Value
Methods
Deconstruct(out TItem, out Point)
Supports C# Deconstruction syntax.
Declaration
public void Deconstruct(out TItem item, out Point position)
Parameters
Type |
Name |
Description |
TItem |
item |
|
Point |
position |
|
Equals(ItemPositionPair<TItem>)
True if the given pair has equivalent items and positions; false otherwise.
Declaration
public bool Equals(ItemPositionPair<TItem> other)
Parameters
Returns
Equals(Object)
True if the given object is an ItemPositionPair that has an equivalent item and position; false otherwise.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
FromTuple((TItem, Point))
Converts the tuple to an equivalent ItemPositionPair.
Declaration
public static ItemPositionPair<TItem> FromTuple((TItem, Point) tuple)
Parameters
Type |
Name |
Description |
(, )<TItem, Point> |
tuple |
|
Returns
GetHashCode()
Returns a hash code based on all of the pair's fields.
Declaration
public override int GetHashCode()
Returns
Matches(ItemPositionPair<TItem>)
True if the given pair has equivalent items and positions; false otherwise.
Declaration
public bool Matches(ItemPositionPair<TItem> other)
Parameters
Returns
ToString()
Returns a string representing the item and the position it's located at.
Declaration
public override string ToString()
Returns
ToTuple()
Converts the pair to an equivalent tuple.
Declaration
public (TItem, Point) ToTuple()
Returns
Operators
Equality(ItemPositionPair<TItem>, ItemPositionPair<TItem>)
True if the given pairs have the same item and position; false otherwise.
Declaration
public static bool operator ==(ItemPositionPair<TItem> left, ItemPositionPair<TItem> right)
Parameters
Returns
Implicit(ItemPositionPair<TItem> to (TItem, Point))
Implicitly converts an ItemPositionPair to an equivalent tuple.
Declaration
public static implicit operator (TItem, Point)(ItemPositionPair<TItem> pair)
Parameters
Returns
Implicit((TItem, Point) to ItemPositionPair<TItem>)
Implicitly converts a tuple to its equivalent ItemPositionPair.
Declaration
public static implicit operator ItemPositionPair<TItem>((TItem, Point) tuple)
Parameters
Type |
Name |
Description |
(, )<TItem, Point> |
tuple |
|
Returns
Inequality(ItemPositionPair<TItem>, ItemPositionPair<TItem>)
True if the given pairs have different items and/or positions; false otherwise.
Declaration
public static bool operator !=(ItemPositionPair<TItem> left, ItemPositionPair<TItem> right)
Parameters
Returns
Implements
Extension Methods