Skip to content

Utils.EnumerableToString(IEnumerable<T>, Func<T, string>, string, bool)

EnumerableToString(IEnumerable<T>, Func<T, string>, string, bool)

static
View source
public static string EnumerableToString<T>(IEnumerable<T>? collection, Func<T, string>? toString = null, string separator = ", ", bool putInBrackets = true)
Returns a human-readable text string that describes an IEnumerable collection of objects.

Parameters

collectionIEnumerable<T>
The IEnumerable to describe.
toStringFunc<T, string>
Converts the element to a string. If none specified, System.Object.ToString will be used.
separatorstring
The separator to use.
putInBracketsbool
Puts elements within brackets

Returns

A string assembled by wrapping the string descriptions of the individual elements with square brackets and separating them with commas.