Example #1
0
        /// <summary>
        /// Writes partial data for the container into the specified format.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="container">The container.</param>
        public override void Write(IFormatWriter writer, object container)
        {
            using (writer.Section(this.Tag))
            {
                var collection = (ICollection <TElement>) this.GetAction(container);

                writer.WriteInteger("Length", collection.Count);
                this.WriteCollection(writer, collection);

                foreach (TElement element in collection)
                {
                    using (writer.Section(this.ElementTag))
                    {
                        this.WriteElement(writer, element);
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Writes property for the specified container.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="container">The container.</param>
 public override void Write(IFormatWriter writer, object container)
 {
     writer.WriteInteger(this.Tag, (int)this.GetAction(container));
 }
Example #3
0
 /// <summary>
 /// Writes the specified value.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="value">The value.</param>
 public override void Write(IFormatWriter writer, int value)
 {
     writer.WriteInteger("Value", value);
 }