/// <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(" >"); }
/// <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(" >"); }