Beispiel #1
0
        /// <summary>
        /// Appends the given memory bytes by pointing <see cref="ReadOnlySequenceSegment{T}.Next"/> to a new <see cref="MapDescriptionSegment"/>.
        /// </summary>
        /// <param name="mem">The memory bytes to append.</param>
        /// <returns>The new instance of <see cref="MapDescriptionSegment"/>, pointing to the segment after this one.</returns>
        public MapDescriptionSegment Append(ReadOnlyMemory <byte> mem)
        {
            var segment = new MapDescriptionSegment(mem)
            {
                RunningIndex = this.RunningIndex + this.Memory.Length,
            };

            this.Next = segment;

            return(segment);
        }
Beispiel #2
0
        /// <summary>
        /// Appends the given <see cref="MapDescriptionSegment"/> to another.
        /// </summary>
        /// <param name="nextSegment">A reference to the next segment.</param>
        public void Append(MapDescriptionSegment nextSegment)
        {
            nextSegment.RunningIndex = this.RunningIndex + this.Memory.Length;

            this.Next = nextSegment;
        }