Click or drag to resize
PairTFirst, TSecond Structure
Stores a pair of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary.

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
[SerializableAttribute]
public struct Pair<TFirst, TSecond> : IComparable, 
	IComparable<Pair<TFirst, TSecond>>

Type Parameters

TFirst

[Missing <typeparam name="TFirst"/> documentation for "T:X3Platform.Collections.Pair`2"]

TSecond

[Missing <typeparam name="TSecond"/> documentation for "T:X3Platform.Collections.Pair`2"]

The PairTFirst, TSecond type exposes the following members.

Constructors
Methods
  NameDescription
Public methodCompareTo

Compares this pair to another pair of the some type. The pairs are compared by using the IComparable<T> or IComparable interface on TFirst and TSecond. The pairs are compared by their first elements first, if their first elements are equal, then they are compared by their second elements.

If either TFirst or TSecond does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the pairs cannot be compared.

Public methodEquals(Object)
Determines if this pair is equal to another object. The pair is equal to another object if that object is a Pair, both element types are the same, and the first and second elements both compare equal using object.Equals.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(PairTFirst, TSecond)
Determines if this pair is equal to another pair. The pair is equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Public methodGetHashCode
Returns a hash code for the pair, suitable for use in a hash-table or other hashed collection. Two pairs that compare equal (using Equals) will have the same hash code. The hash code for the pair is derived by combining the hash codes for each of the two elements of the pair.
(Overrides ValueTypeGetHashCode.)
Public methodGetType (Inherited from Object.)
Public methodToKeyValuePair
Converts this Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Public methodToString
Returns a string representation of the pair. The string representation of the pair is of the form: First: {0}, Second: {1} where {0} is the result of First.ToString(), and {1} is the result of Second.ToString() (or "null" if they are null.)
(Overrides ValueTypeToString.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Determines if two pairs are equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Public operatorStatic member(KeyValuePairTFirst, TSecond to PairTFirst, TSecond)
Converts a KeyValuePair structure into a Pair. The First element gets the Key, and the Second element gets the Value.
Public operatorStatic member(PairTFirst, TSecond to KeyValuePairTFirst, TSecond)
Converts a Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Public operatorStatic memberInequality
Determines if two pairs are not equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Top
Fields
  NameDescription
Public fieldFirst
The first element of the pair.
Public fieldSecond
The second element of the pair.
Top
See Also