STuple<T1, T2, T3, T4, T5>
Namespace: SnowBank.Data.Tuples · struct
Implements: IVarTuple, IEquatable<IVarTuple>, IComparable<IVarTuple>, IReadOnlyList<object>, IEnumerable<object>, IEnumerable, IReadOnlyCollection<object>, IStructuralEquatable, IStructuralComparable, ITuple, IFormattable, IEquatable<STuple<T1, T2, T3, T4, T5>>, IComparable<STuple<T1, T2, T3, T4, T5>>, IEquatable<(T1, T2, T3, T4, T5)>, IComparable<(T1, T2, T3, T4, T5)>, IComparable, ITupleSpanPackable, ITuplePackable, ITupleFormattable, ISpanFormattable, ISpanEncodable
Tuple that can hold five items
Constructors
STuple<T1, T2, T3, T4, T5>
STuple<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5)
Constructs a STuple
Properties
Count
int Count { get; }
Number of items in this tuple
Item
object Item { get; }
IVarTuple Item { get; }
IVarTuple Item { get; }
Last
T5 Last { get; }
Return the value of the last item in the tuple
Tail
STuple<T2, T3, T4, T5> Tail { get; }
Return a tuple without the first item
Methods
Append
STuple<T1, T2, T3, T4, T5, T6> Append<T6>(T6 value)
Appends a single new item at the end of the current tuple.
value— Value that will be added as an embedded item
Returns: New tuple with one extra item
If is a tuple, and you want to append the items of this tuple, and not the tuple itself, please call !
STuple<T1, T2, T3, T4, T5, T6, T7> Append<T6, T7>(T6 value1, T7 value2)
Appends two new items at the end of the current tuple.
value1— First item that will be added as an embedded itemvalue2— Second item that will be added as an embedded item
Returns: New tuple with two extra item
If any of or is a tuple, and you want to append the items of this tuple, and not the tuple itself, please call !
CompareTo
int CompareTo(STuple<T1, T2, T3, T4, T5> other)
int CompareTo((T1, T2, T3, T4, T5) other)
int CompareTo(IVarTuple other)
Concat
IVarTuple Concat(IVarTuple tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
STuple<T1, T2, T3, T4, T5, T6> Concat<T6>(STuple<T6> tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
STuple<T1, T2, T3, T4, T5, T6> Concat<T6>((T6) tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
STuple<T1, T2, T3, T4, T5, T6, T7> Concat<T6, T7>((T6, T7) tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
STuple<T1, T2, T3, T4, T5, T6, T7> Concat<T6, T7>(STuple<T6, T7> tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
STuple<T1, T2, T3, T4, T5, T6, T7, T8> Concat<T6, T7, T8>((T6, T7, T8) tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
STuple<T1, T2, T3, T4, T5, T6, T7, T8> Concat<T6, T7, T8>(STuple<T6, T7, T8> tuple)
Appends the items of a tuple at the end of the current tuple.
tuple— Tuple whose items are to be appended at the end
Returns: New tuple composed of the current tuple items, followed by tuple's items
CopyTo
void CopyTo(object[] array, int offset)
Copy all the items of this tuple into an array at the specified offset
Deconstruct
void Deconstruct(out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5)
Deconstructs this tuple into its individual elements
Equals
bool Equals(object obj)
bool Equals(IVarTuple other)
bool Equals(STuple<T1, T2, T3, T4, T5> other)
bool Equals((T1, T2, T3, T4, T5) other)
Fill
void Fill(ref (T1, T2, T3, T4, T5) t)
Copies the content of this tuple into the tuple at the specified location
Get
TItem Get<TItem>(int index)
Returns the typed value of an item of the tuple, given its position
index— Position of the item
Returns: Value of the item at position index, adapted into type TItem.
STuple.Create("Hello", "World", 123,).Get<string>(0) => "Hello"STuple.Create("Hello", "World", 123,).Get<int>(2) => 123STuple.Create("Hello", "World", 123,).Get<string>(2) => "123"
TItem Get<TItem>(Index index)
Returns the typed value of an item of the tuple, given its position
index— Position of the item
Returns: Value of the item at position index, adapted into type TItem.
STuple.Create("Hello", "World", 123,).Get<string>(0) => "Hello"STuple.Create("Hello", "World", 123,).Get<int>(^1) => 123STuple.Create("Hello", "World", 123,).Get<string>(^1) => "123"
GetEnumerator
IEnumerator<object> GetEnumerator()
GetHashCode
int GetHashCode()
ToString
string ToString()
string ToString(string format, IFormatProvider provider = null)
ToValueTuple
(T1, T2, T3, T4, T5) ToValueTuple()
TryFormat
bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = null, IFormatProvider provider = null)
With
void With(Action<T1, T2, T3, T4, T5> lambda)
Execute a lambda Action with the content of this tuple
lambda— Action that will be passed the content of this tuple as parameters
TItem With<TItem>(Func<T1, T2, T3, T4, T5, TItem> lambda)
Execute a lambda Function with the content of this tuple
lambda— Action that will be passed the content of this tuple as parameters
Returns: Result of calling lambda with the items of this tuple
Fields
Item1
readonly T1 Item1
First element of the tuple
Item2
readonly T2 Item2
Second element of the tuple
Item3
readonly T3 Item3
Third element of the tuple
Item4
readonly T4 Item4
Fourth element of the tuple
Item5
readonly T5 Item5
Fifth and last element of the tuple