Exemple #1
0
        public static ReadOnlyBytes Create(params byte[][] buffers)
        {
            MemoryListNode first   = null;
            MemoryListNode current = null;

            foreach (var buffer in buffers)
            {
                if (first == null)
                {
                    current = new MemoryListNode();
                    first   = current;
                }
                else
                {
                    current._rest = new MemoryListNode();
                    current       = current._rest;
                }
                current._first = buffer;
            }

            if (first.Rest == null)
            {
                return(new ReadOnlyBytes(first, first.First.Length));
            }
            else
            {
                return(new ReadOnlyBytes(first));
            }
        }
        private ReadOnlyBytes Create(params byte[][] buffers)
        {
            MemoryListNode first   = null;
            MemoryListNode current = null;

            foreach (var buffer in buffers)
            {
                if (first == null)
                {
                    current = new MemoryListNode();
                    first   = current;
                }
                else
                {
                    current._rest = new MemoryListNode();
                    current       = current._rest;
                }
                current._first = buffer;
            }
            return(new ReadOnlyBytes(first));
        }