WriteValue() public abstract method

Writes the text for a generalized value.
public abstract WriteValue ( object val ) : void
val object The value.
return void
Esempio n. 1
0
        /// <summary>
        /// Displays elements from a collection on a line
        /// </summary>
        /// <param name="label">Text to prefix the line with</param>
        /// <param name="list">The list of items to display</param>
        /// <param name="index">The index in the collection of the first element to display</param>
        /// <param name="max">The maximum number of elements to display</param>
        private void DisplayElements(MessageWriter writer, string prefix, ICollection collection, int index, int max)
        {
            writer.Write(prefix + "< ");

            if (collection == null)
            {
                writer.Write("null");
            }
            else if (collection.Count == 0)
            {
                writer.Write("empty");
            }
            else
            {
                for (int i = 0; i < max && index < collection.Count; i++)
                {
                    if (i > 0)
                    {
                        writer.Write(", ");
                    }

                    writer.WriteValue(GetValueFromCollection(collection, index++));
                }

                if (index < collection.Count)
                {
                    writer.Write("...");
                }
            }

            writer.Write(" >");
        }
Esempio n. 2
0
        /// <summary>
        /// Displays elements from a collection on a line
        /// </summary>
        /// <param name="label">Text to prefix the line with</param>
        /// <param name="list">The list of items to display</param>
        /// <param name="index">The index in the collection of the first element to display</param>
        /// <param name="max">The maximum number of elements to display</param>
        private void DisplayElements(MessageWriter writer, string prefix, ICollection collection, int index, int max)
        {
            writer.Write(prefix + "< ");

            if (collection == null)
                writer.Write("null");
            else if (collection.Count == 0)
                writer.Write("empty");
            else
            {
                for (int i = 0; i < max && index < collection.Count; i++)
                {
                    if (i > 0) writer.Write(", ");

                    writer.WriteValue(GetValueFromCollection(collection, index++));
                }

                if (index < collection.Count)
                    writer.Write("...");
            }

            writer.Write(" >");
        }