Edit

Share via


Utils.EnumerableToString<T> Method

Definition

Returns a human-readable text string that describes an IEnumerable collection of objects.

public static string EnumerableToString<T> (System.Collections.Generic.IEnumerable<T> collection, Func<T,string> toString = default, string separator = ", ", bool putInBrackets = true);
public static string EnumerableToString<T> (System.Collections.Generic.IEnumerable<T>? collection, Func<T,string>? toString = default, string separator = ", ", bool putInBrackets = true);
static member EnumerableToString : seq<'T> * Func<'T, string> * string * bool -> string
Public Function EnumerableToString(Of T) (collection As IEnumerable(Of T), Optional toString As Func(Of T, String) = Nothing, Optional separator As String = ", ", Optional putInBrackets As Boolean = true) As String

Type Parameters

T

The type of the list elements.

Parameters

collection
IEnumerable<T>

The IEnumerable to describe.

toString
Func<T,String>

Converts the element to a string. If none specified, ToString() will be used.

separator
String

The separator to use.

putInBrackets
Boolean

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.

Applies to