IndexOf<>(source, predicate, startIndex) IndexOf<>(source, element, comparer) JoinString<>(values, separator, prefix, suffix, lastSeparator) Order<>(source, comparer) SkipLast<>(source, count, throwIfNotEnough) Split<>(splitWhat, splitWhere) Split<>(source, chunkSize) ToDictionary2<>(source, key1Selector, key2Selector, comparer1, comparer2) ToDictionary2<>(source, key1Selector, key2Selector, elementSelector, comparer1, comparer2)
Legend Class Struct Enum Interface Delegate | Constructor Method Property Event Field |
| Extension method: string JoinString<T>(this IEnumerable<T>, string, string, string, string)Declarationpublic static string JoinString<T>(
this IEnumerable<T> values,
string separator = null,
string prefix = null,
string suffix = null,
string lastSeparator = null
) Summary
Turns all elements in the enumerable to strings and joins them using the specified separator and the specified prefix and suffix for each string. Generic type parametersT | This type parameter is not documented. |
Parametersthis IEnumerable<T> | values |
The sequence of elements to join into a string. | string | separator |
Optionally, a separator to insert between each element and the next. | string | prefix |
Optionally, a string to insert in front of each element. | string | suffix |
Optionally, a string to insert after each element. | string | lastSeparator |
Optionally, a separator to use between the second-to-last and the last element. |
Example
// Returns "[Paris], [London], [Tokyo]"
(new[] { "Paris", "London", "Tokyo" }).JoinString(", ", "[", "]")
// Returns "[Paris], [London] and [Tokyo]"
(new[] { "Paris", "London", "Tokyo" }).JoinString(", ", "[", "]", " and "); |