STuple<T1, T2, T3, T4, T5, T6>

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, T6>>, IComparable<STuple<T1, T2, T3, T4, T5, T6>>, IEquatable<(T1, T2, T3, T4, T5, T6)>, IComparable<(T1, T2, T3, T4, T5, T6)>, IComparable, ITupleSpanPackable, ITuplePackable, ITupleFormattable, ISpanFormattable, ISpanEncodable

Tuple that can hold six items

Constructors

STuple<T1, T2, T3, T4, T5, T6>

STuple<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6)

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

T6 Last { get; }

Value of the last item in the tuple

Tail

STuple<T2, T3, T4, T5, T6> Tail { get; }

Tuple without the first item

Methods

Append

STuple<T1, T2, T3, T4, T5, T6, T7> Append<T7>(T7 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, T8> Append<T7, T8>(T7 value1, T8 value2)

Appends two new items at the end of the current tuple.

  • value1 — First item that will be added as an embedded item
  • value2 — 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, T6> other)

int CompareTo((T1, T2, T3, T4, T5, T6) 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, T7> Concat<T7>(STuple<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<T7>((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<T7, T8>(STuple<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<T7, T8>((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, out T6 item6)

Deconstructs this tuple into its individual elements

Equals

bool Equals(object obj)

bool Equals(IVarTuple other)

bool Equals(STuple<T1, T2, T3, T4, T5, T6> other)

bool Equals((T1, T2, T3, T4, T5, T6) other)

Fill

void Fill(ref (T1, T2, T3, T4, T5, T6) 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, T6) ToValueTuple()

Returns the equivalent ValueTuple

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, T6> lambda)

Executes 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, T6, TItem> lambda)

Executes 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 element of the tuple

Item6

readonly T6 Item6

Sixth and last element of the tuple