Formats collections into localized, human-readable lists.
public interface ICollectionFormatterBuilt-in implementations ignore rendered items that are null, empty, or whitespace after
formatting, and they may trim the surviving values before joining them. They also expect the
input collection and any formatter delegate to be non-null.
Formats the collection for display by calling ToString() on each item.
string Humanize<T>(System.Collections.Generic.IEnumerable<T> collection);T
The item type in the collection.
collection System.Collections.Generic.IEnumerable<T>
The collection to format.
System.String
The formatted collection.
System.ArgumentNullException
If collection is null.
Formats the collection for display by calling ToString() on each item and using
separator to join the rendered items.
string Humanize<T>(System.Collections.Generic.IEnumerable<T> collection, string separator);T
The item type in the collection.
collection System.Collections.Generic.IEnumerable<T>
The collection to format.
separator System.String
The localized separator used to join the rendered items.
System.String
The formatted collection.
System.ArgumentNullException
If collection is null.
Implementations may place the separator before the final item or between every item depending on the list style.
Formats the collection for display by calling objectFormatter on each item.
string Humanize<T>(System.Collections.Generic.IEnumerable<T> collection, System.Func<T,object?> objectFormatter);T
The item type in the collection.
collection System.Collections.Generic.IEnumerable<T>
The collection to format.
objectFormatter System.Func<T,System.Object>
The formatter used to convert each item into text.
System.String
The formatted collection.
System.ArgumentNullException
If collection or objectFormatter is null.
Formats the collection for display by calling objectFormatter on each item and using separator to join the rendered items.
string Humanize<T>(System.Collections.Generic.IEnumerable<T> collection, System.Func<T,object?> objectFormatter, string separator);T
The item type in the collection.
collection System.Collections.Generic.IEnumerable<T>
The collection to format.
objectFormatter System.Func<T,System.Object>
The formatter used to convert each item into text.
separator System.String
The localized separator used to join the rendered items.
System.String
The formatted collection.
System.ArgumentNullException
If collection or objectFormatter is null.
Implementations may place the separator before the final item or between every item depending on the list style.
Formats the collection for display by calling objectFormatter on each item.
string Humanize<T>(System.Collections.Generic.IEnumerable<T> collection, System.Func<T,string?> objectFormatter);T
The item type in the collection.
collection System.Collections.Generic.IEnumerable<T>
The collection to format.
objectFormatter System.Func<T,System.String>
The formatter used to convert each item into text.
System.String
The formatted collection.
System.ArgumentNullException
If collection or objectFormatter is null.
Formats the collection for display by calling objectFormatter on each item and using separator to join the rendered items.
string Humanize<T>(System.Collections.Generic.IEnumerable<T> collection, System.Func<T,string?> objectFormatter, string separator);T
The item type in the collection.
collection System.Collections.Generic.IEnumerable<T>
The collection to format.
objectFormatter System.Func<T,System.String>
The formatter used to convert each item into text.
separator System.String
The localized separator used to join the rendered items.
System.String
The formatted collection.
System.ArgumentNullException
If collection or objectFormatter is null.
Implementations may place the separator before the final item or between every item depending on the list style.