Show / Hide Table of Contents

Class ItemPositionPair<TItem>

Item-location pair denoting an entry in a spatial map.

Inheritance
Object
ItemPositionPair<TItem>
Implements
IEquatable<ItemPositionPair<TItem>>
IMatchable<ItemPositionPair<TItem>>
Namespace: SadRogue.Primitives.SpatialMaps
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)

Constructor.

Declaration
public ItemPositionPair(TItem item, Point position)
Parameters
Type Name Description
TItem item
Point position

Fields

Item

The item.

Declaration
public readonly TItem Item
Field Value
Type Description
TItem

Position

The position the item is located at.

Declaration
public readonly Point Position
Field Value
Type Description
Point

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
Type Name Description
ItemPositionPair<TItem> other
Returns
Type Description
Boolean

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
Type Description
Boolean

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
Type Description
ItemPositionPair<TItem>

GetHashCode()

Returns a hash code based on all of the pair's fields.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

Matches(ItemPositionPair<TItem>)

True if the given pair has equivalent items and positions; false otherwise.

Declaration
public bool Matches(ItemPositionPair<TItem> other)
Parameters
Type Name Description
ItemPositionPair<TItem> other
Returns
Type Description
Boolean

ToString()

Returns a string representing the item and the position it's located at.

Declaration
public override string ToString()
Returns
Type Description
String

ToTuple()

Converts the pair to an equivalent tuple.

Declaration
public (TItem, Point) ToTuple()
Returns
Type Description
(, )<TItem, Point>

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
Type Name Description
ItemPositionPair<TItem> left
ItemPositionPair<TItem> right
Returns
Type Description
Boolean

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
Type Name Description
ItemPositionPair<TItem> pair
Returns
Type Description
(, )<TItem, Point>

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
Type Description
ItemPositionPair<TItem>

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
Type Name Description
ItemPositionPair<TItem> left
ItemPositionPair<TItem> right
Returns
Type Description
Boolean

Implements

System.IEquatable<T>
IMatchable<T>

Extension Methods

PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>)
PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>, EventHandler<ValueChangedEventArgs<TProperty>>)
In This Article
Back to top Generated by DocFX