Show / Hide Table of Contents

Struct ItemPositionPair<TItem>

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

Implements
IEquatable<ItemPositionPair<TItem>>
IMatchable<ItemPositionPair<TItem>>
Inherited Members
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
[DataContract]
public readonly struct ItemPositionPair<TItem> : IEquatable<ItemPositionPair<TItem>>, IMatchable<ItemPositionPair<TItem>> where TItem : notnull
Type Parameters
Name Description
TItem

The type of item stored in the pairing.

Constructors

View Source

ItemPositionPair(TItem, Point)

Constructor.

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

Fields

View Source

Item

The item.

Declaration
[DataMember]
public readonly TItem Item
Field Value
Type Description
TItem
View Source

Position

The position the item is located at.

Declaration
[DataMember]
public readonly Point Position
Field Value
Type Description
Point

Methods

View Source

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
View Source

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
bool
View Source

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
bool
Overrides
ValueType.Equals(object)
View Source

FromTuple((TItem item, Point position))

Converts the tuple to an equivalent ItemPositionPair.

Declaration
public static ItemPositionPair<TItem> FromTuple((TItem item, Point position) tuple)
Parameters
Type Name Description
(TItem item, Point position) tuple
Returns
Type Description
ItemPositionPair<TItem>
View Source

GetHashCode()

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

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
ValueType.GetHashCode()
View Source

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
bool
View Source

ToString()

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

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
ValueType.ToString()
View Source

ToTuple()

Converts the pair to an equivalent tuple.

Declaration
public (TItem item, Point position) ToTuple()
Returns
Type Description
(TItem item, Point position)

Operators

View Source

operator ==(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
bool
View Source

implicit operator (TItem item, Point position)(ItemPositionPair<TItem>)

Implicitly converts an ItemPositionPair to an equivalent tuple.

Declaration
public static implicit operator (TItem item, Point position)(ItemPositionPair<TItem> pair)
Parameters
Type Name Description
ItemPositionPair<TItem> pair
Returns
Type Description
(TItem item, Point position)
View Source

implicit operator ItemPositionPair<TItem>((TItem item, Point position))

Implicitly converts a tuple to its equivalent ItemPositionPair.

Declaration
public static implicit operator ItemPositionPair<TItem>((TItem item, Point position) tuple)
Parameters
Type Name Description
(TItem item, Point position) tuple
Returns
Type Description
ItemPositionPair<TItem>
View Source

operator !=(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
bool

Implements

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>>?)
  • View Source
In this article
Back to top Generated by DocFX