12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- public static class Tuple
- {
- public static Tuple<T1, T2> Create<T1, T2>(T1 item1, T2 second)
- {
- return new Tuple<T1, T2>(item1, second);
- }
- public static Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 second, T3 third)
- {
- return new Tuple<T1, T2, T3>(item1, second, third);
- }
- public static Tuple<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 item1, T2 second, T3 third, T4 fourth)
- {
- return new Tuple<T1, T2, T3, T4>(item1, second, third, fourth);
- }
- public static void Unpack<T1, T2>(this Tuple<T1, T2> tuple, out T1 ref1, out T2 ref2)
- {
- ref1 = tuple.Item1;
- ref2 = tuple.Item2;
- }
- public static void Unpack<T1, T2, T3>(this Tuple<T1, T2, T3> tuple, out T1 ref1, out T2 ref2, T3 ref3)
- {
- ref1 = tuple.Item1;
- ref2 = tuple.Item2;
- ref3 = tuple.Item3;
- }
- public static void Unpack<T1, T2, T3, T4>(this Tuple<T1, T2, T3, T4> tuple, out T1 ref1, out T2 ref2, T3 ref3, T4 ref4)
- {
- ref1 = tuple.Item1;
- ref2 = tuple.Item2;
- ref3 = tuple.Item3;
- ref4 = tuple.Item4;
- }
- }
|