// ReSharper disable UnusedMember.Local private static Tuple BuildPersistentTuple(Tuple tuple, Tuple tuplePrototype, int[] mapping) { var result = tuplePrototype.CreateNew(); tuple.CopyTo(result, mapping); return(result); }
/// <summary> /// Creates <see cref="RegularTuple"/> instance "filled" with the same field values /// as the specified <paramref name="source"/> tuple. /// </summary> /// <param name="source">The tuple to clone as <see cref="RegularTuple"/>.</param> /// <returns>A new instance of <see cref="RegularTuple"/> with the same field values /// as the specified <paramref name="source"/> tuple.</returns> public static RegularTuple ToRegular(this Tuple source) { if (source == null) { return(null); } var result = Tuple.Create(source.Descriptor); source.CopyTo(result); return(result); }
/// <summary> /// Copies all the elements from <paramref name="source"/> <see cref="Tuple"/> /// starting at the first element /// and pastes them into <paramref name="target"/> <see cref="Tuple"/> /// starting at the first element. /// </summary> /// <param name="source">Source tuple to copy.</param> /// <param name="target">Tuple that receives the data.</param> public static void CopyTo(this Tuple source, Tuple target) { source.CopyTo(target, 0, 0, source.Count); }
/// <summary> /// Copies a range of elements from <paramref name="source"/> <see cref="Tuple"/> /// starting at the <paramref name="startIndex"/> /// and pastes them into <paramref name="target"/> <see cref="Tuple"/> /// starting at the first element. /// </summary> /// <param name="source">Source tuple to copy.</param> /// <param name="target">Tuple that receives the data.</param> /// <param name="startIndex">The index in the <paramref name="source"/> tuple at which copying begins.</param> public static void CopyTo(this Tuple source, Tuple target, int startIndex) { source.CopyTo(target, startIndex, 0, source.Count - startIndex); }
/// <summary> /// Copies a range of elements from <paramref name="source"/> <see cref="Tuple"/> /// starting at the specified source index /// and pastes them to <paramref name="target"/> <see cref="Tuple"/> /// starting at the first element. /// </summary> /// <param name="source">Source tuple to copy.</param> /// <param name="target">Tuple that receives the data.</param> /// <param name="startIndex">The index in the <paramref name="source"/> tuple at which copying begins.</param> /// <param name="length">The number of elements to copy.</param> public static void CopyTo(this Tuple source, Tuple target, int startIndex, int length) { source.CopyTo(target, startIndex, 0, length); }