+ /// <summary>Converts the current instance to an equivalent string representation.</summary>
+ /// <returns>An equivalent string representation of the current instance.</returns>
+ /// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) is not supported.</exception>
+ public override string ToString()
+ {
+ return ToString("G");
+ }
+
+ /// <summary>Converts the current instance to an equivalent string representation using the specified format.</summary>
+ /// <param name="format">The format specifier used to format the individual elements of the current instance.</param>
+ /// <returns>An equivalent string representation of the current instance.</returns>
+ /// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) is not supported.</exception>
+ public string ToString(string format)
+ {
+ return ToString(format, CultureInfo.CurrentCulture);
+ }
+
+ /// <summary>Converts the current instance to an equivalent string representation using the specified format.</summary>
+ /// <param name="format">The format specifier used to format the individual elements of the current instance.</param>
+ /// <param name="formatProvider">The format provider used to format the individual elements of the current instance.</param>
+ /// <returns>An equivalent string representation of the current instance.</returns>
+ /// <exception cref="NotSupportedException">The type of the current instance (<typeparamref name="T" />) is not supported.</exception>
+ public string ToString(string format, IFormatProvider formatProvider)
+ {
+ ThrowIfUnsupportedType();
+
+ string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
+ int lastElement = Count - 1;
+
+ var sb = StringBuilderCache.Acquire();
+ sb.Append('<');
+
+ for (int i = 0; i < lastElement; i++)
+ {
+ sb.Append(((IFormattable)(GetElement(i))).ToString(format, formatProvider));
+ sb.Append(separator);
+ sb.Append(' ');
+ }
+ sb.Append(((IFormattable)(GetElement(lastElement))).ToString(format, formatProvider));
+
+ sb.Append('>');
+ return StringBuilderCache.GetStringAndRelease(sb);
+ }
+