Lawo.EmberPlusSharp.Ember.EmberWriter.WriteEndContainer C# (CSharp) Method

WriteEndContainer() public method

Writes the end of the previous sequence, set or application-defined type.
has been called.
public WriteEndContainer ( ) : void
return void
        public void WriteEndContainer()
        {
            this.AssertNotDisposed();
            this.writeBuffer.Reserve(4);
            WriteIdentifier(this.writeBuffer, EndContainer);
            WriteLength(this.writeBuffer, 0, 0, 1);
            WriteIdentifier(this.writeBuffer, EndContainer);
            WriteLength(this.writeBuffer, 0, 0, 1);
        }

Usage Example

        /// <summary>Reads data and writes it to <paramref name="writer"/> until the end of the current container is
        /// reached.</summary>
        /// <returns>The contents of the of the data value with the outer id <paramref name="outerId"/>, if such a
        /// data value was found in the current container and its contents is primitive; otherwise, <c>null</c>.
        /// </returns>
        /// <exception cref="ObjectDisposedException"><see cref="Dispose"/> has been called.</exception>
        /// <remarks>
        /// <para>While <see cref="Read"/> returns <c>true</c> and <see cref="InnerNumber"/> is not equal to
        /// <see cref="Ember.InnerNumber.EndContainer"/>, calls <see cref="Copy"/>.</para>
        /// </remarks>
        public object CopyToEndContainer(EmberWriter writer, EmberId?outerId)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }

            object result = null;
            var    inner  = -1;

            while (this.Read() && ((inner = this.innerNumber.GetValueOrDefault()) != Ember.InnerNumber.EndContainer))
            {
                var candidate = this.CopyCore(writer, inner);

                if (this.outer.HasValue && (this.outer.Value == outerId))
                {
                    result = candidate;
                }
            }

            if (inner == Ember.InnerNumber.EndContainer)
            {
                writer.WriteEndContainer();
            }

            return(result);
        }
All Usage Examples Of Lawo.EmberPlusSharp.Ember.EmberWriter::WriteEndContainer