/// <summary>Create a new list tuple by merging the items of three tuples together</summary> public ListTuple(ListTuple <T> a, ListTuple <T> b, ListTuple <T> c) { Contract.NotNull(a); Contract.NotNull(b); Contract.NotNull(c); int nA = a.Count; int nB = b.Count; int nC = c.Count; var items = new T[checked (nA + nB + nC)]; if (nA > 0) { a.CopyTo(items, 0); } if (nB > 0) { b.CopyTo(items, nA); } if (nC > 0) { c.CopyTo(items, nA + nB); } m_items = items; }
public ListTuple Concat(ListTuple tuple) { Contract.NotNull(tuple, nameof(tuple)); if (tuple.m_count == 0) { return(this); } if (m_count == 0) { return(tuple); } var list = new object[m_count + tuple.m_count]; Array.Copy(m_items, m_offset, list, 0, m_count); Array.Copy(tuple.m_items, tuple.m_offset, list, m_count, tuple.m_count); return(new ListTuple(list, 0, list.Length)); }
/// <summary>Create a new list tuple by merging the items of two tuples together</summary> public ListTuple(ListTuple <T> a, ListTuple <T> b) { Contract.NotNull(a); Contract.NotNull(b); int nA = a.Count; int nB = b.Count; var items = new T[checked (nA + nB)]; if (nA > 0) { a.CopyTo(items, 0); } if (nB > 0) { b.CopyTo(items, nA); } m_items = items.AsMemory(); }