Table of Contents

Class StringExtensions

Namespace
Motiv
Assembly
Motiv.dll

Provides extension methods for strings.

public static class StringExtensions
Inheritance
StringExtensions
Inherited Members

Methods

Serialize<T>(IEnumerable<T>)

Serializes a collection to a human-readable string. It will separate the items with ", " and the last item with ", and ".

public static string Serialize<T>(this IEnumerable<T> collection)

Parameters

collection IEnumerable<T>

The collection to serialize.

Returns

string

The serialized string.

Type Parameters

T

Serialize<T>(IEnumerable<T>, string, bool)

Serializes a collection to a human-readable string.

public static string Serialize<T>(this IEnumerable<T> collection, string conjunction, bool useOxfordComma = true)

Parameters

collection IEnumerable<T>

The collection to serialize.

conjunction string

The coordinating conjunction (i.e. "and", "or" etc) to be used between the last two items

useOxfordComma bool

A value indicating whether to use a comma as well as a conjunction between the last two items.

Returns

string

The serialized string.

Type Parameters

T