Exemplo n.º 1
0
        /// <summary>Create a new list tuple by merging the items of two tuples together</summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        internal FdbListTuple(IFdbTuple a, IFdbTuple b)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }
            if (b == null)
            {
                throw new ArgumentNullException("b");
            }

            int nA = a.Count;
            int nB = b.Count;

            m_offset = 0;
            m_count  = nA + nB;
            m_items  = new object[m_count];

            if (nA > 0)
            {
                a.CopyTo(m_items, 0);
            }
            if (nB > 0)
            {
                b.CopyTo(m_items, nA);
            }
        }
        public static object[] ToArray([NotNull] this IFdbTuple tuple)
        {
            if (tuple == null)
            {
                throw new ArgumentNullException("tuple");
            }

            var items = new object[tuple.Count];

            if (items.Length > 0)
            {
                tuple.CopyTo(items, 0);
            }
            return(items);
        }
        public FdbListTuple Concat(IFdbTuple tuple)
        {
            var _ = tuple as FdbListTuple;

            if (_ != null)
            {
                return(Concat(_));
            }

            int count = tuple.Count;

            if (count == 0)
            {
                return(this);
            }

            var list = new object[m_count + count];

            Array.Copy(m_items, m_offset, list, 0, m_count);
            tuple.CopyTo(list, m_count);
            return(new FdbListTuple(list, 0, list.Length));
        }
 public void CopyTo([NotNull] object[] array, int offset)
 {
     m_items.CopyTo(array, offset);
 }