Table of Contents

Class CAChangeContent

Namespace
SunamoCollectionsChangeContent
Assembly
SunamoCollectionsChangeContent.dll

Provides methods for modifying collections of strings with custom transformation functions.

public class CAChangeContent
Inheritance
CAChangeContent
Inherited Members
Extension Methods

Methods

ChangeContent0(ChangeContentArgs?, List<string?>, Func<string?, string?>)

Directly edits the collection by applying a transformation function to each element. The method name suffix indicates the number of additional parameters passed to the delegate (0 in this case). If not every element fulfills the pattern, it is good to remove null values from the result.

public static List<string?> ChangeContent0(ChangeContentArgs? args, List<string?> list, Func<string?, string?> func)

Parameters

args ChangeContentArgs

Configuration arguments for the transformation.

list List<string>

The list of strings to transform.

func Func<string, string>

The transformation function to apply to each element.

Returns

List<string>

The modified list of strings.

ChangeContent1<TArg>(ChangeContentArgs?, List<string?>, Func<string?, TArg, string?>, TArg)

Directly edits the collection by applying a transformation function with one additional argument to each element. The method name suffix indicates the number of additional parameters passed to the delegate (1 in this case).

public static List<string?> ChangeContent1<TArg>(ChangeContentArgs? args, List<string?> list, Func<string?, TArg, string?> func, TArg argument1)

Parameters

args ChangeContentArgs

Configuration arguments for the transformation.

list List<string>

The list of strings to transform.

func Func<string, TArg, string>

The transformation function to apply to each element.

argument1 TArg

The first argument to pass to the transformation function.

Returns

List<string>

The modified list of strings.

Type Parameters

TArg

The type of the argument to pass to the transformation function.

ChangeContent2<TArg1, TArg2>(ChangeContentArgs?, List<string?>, Func<string?, TArg1, TArg2, string?>, TArg1, TArg2)

Directly edits the collection by applying a transformation function with two additional arguments to each element. The method name suffix indicates the number of additional parameters passed to the delegate (2 in this case).

public static List<string?> ChangeContent2<TArg1, TArg2>(ChangeContentArgs? args, List<string?> list, Func<string?, TArg1, TArg2, string?> func, TArg1 argument1, TArg2 argument2)

Parameters

args ChangeContentArgs

Configuration arguments for the transformation.

list List<string>

The list of strings to transform.

func Func<string, TArg1, TArg2, string>

The transformation function to apply to each element.

argument1 TArg1

The first argument to pass to the transformation function.

argument2 TArg2

The second argument to pass to the transformation function.

Returns

List<string>

The modified list of strings.

Type Parameters

TArg1

The type of the first argument to pass to the transformation function.

TArg2

The type of the second argument to pass to the transformation function.

ChangeContentSwitch12<TArg>(List<string?>, Func<TArg, string?, string?>, TArg)

Changes the content of the collection by applying a transformation function with switched parameter order. The function receives the argument first, then the string element.

public static List<string?> ChangeContentSwitch12<TArg>(List<string?> list, Func<TArg, string?, string?> func, TArg argument)

Parameters

list List<string>

The list of strings to transform.

func Func<TArg, string, string>

The transformation function with switched parameter order (argument first, then string).

argument TArg

The argument to pass to the transformation function.

Returns

List<string>

The modified list of strings.

Type Parameters

TArg

The type of the argument to pass to the transformation function.

ChangeContentWithCondition(ChangeContentArgs?, List<string?>, Predicate<string?>, Func<string?, string?>)

Directly edits the collection by applying a transformation function only to elements that satisfy the predicate. Earlier name was ChangeContent, but has Predicate parameter, hence the name ChangeContentWithCondition.

public static bool ChangeContentWithCondition(ChangeContentArgs? args, List<string?> list, Predicate<string?> predicate, Func<string?, string?> func)

Parameters

args ChangeContentArgs

Configuration arguments for the transformation.

list List<string>

The list of strings to transform.

predicate Predicate<string>

The condition that determines which elements to transform.

func Func<string, string>

The transformation function to apply to matching elements.

Returns

bool

True if any element was changed, false otherwise.

ChangeContent<TArg>(ChangeContentArgs?, List<string?>, Func<string?, TArg, string?>, TArg, Func<TArg, string?, string?>?)

Directly edits the input collection by applying a transformation function. Supports both normal parameter order and switched parameter order via the funcSwitch12 parameter.

public static List<string?> ChangeContent<TArg>(ChangeContentArgs? args, List<string?> list, Func<string?, TArg, string?> func, TArg argument, Func<TArg, string?, string?>? funcSwitch12 = null)

Parameters

args ChangeContentArgs

Configuration arguments for the transformation.

list List<string>

The list of strings to transform.

func Func<string, TArg, string>

The transformation function with normal parameter order (string first, then argument).

argument TArg

The argument to pass to the transformation function.

funcSwitch12 Func<TArg, string, string>

Optional transformation function with switched parameter order (argument first, then string).

Returns

List<string>

The modified list of strings.

Type Parameters

TArg

The type of the argument to pass to the transformation function.

ChangeContent<TArg1, TArg2>(ChangeContentArgs?, List<string?>, Func<string?, TArg1, TArg2, string?>, TArg1, TArg2)

Directly edits the collection by applying a transformation function with two arguments to each element. This overload is provided for convenience when working with two generic argument types.

public static List<string?> ChangeContent<TArg1, TArg2>(ChangeContentArgs? args, List<string?> list, Func<string?, TArg1, TArg2, string?> func, TArg1 argument1, TArg2 argument2)

Parameters

args ChangeContentArgs

Configuration arguments for the transformation.

list List<string>

The list of strings to transform.

func Func<string, TArg1, TArg2, string>

The transformation function to apply to each element.

argument1 TArg1

The first argument to pass to the transformation function.

argument2 TArg2

The second argument to pass to the transformation function.

Returns

List<string>

The modified list of strings.

Type Parameters

TArg1

The type of the first argument to pass to the transformation function.

TArg2

The type of the second argument to pass to the transformation function.