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
argsChangeContentArgsConfiguration arguments for the transformation.
listList<string>The list of strings to transform.
funcFunc<string, string>The transformation function to apply to each element.
Returns
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
argsChangeContentArgsConfiguration arguments for the transformation.
listList<string>The list of strings to transform.
funcFunc<string, TArg, string>The transformation function to apply to each element.
argument1TArgThe first argument to pass to the transformation function.
Returns
Type Parameters
TArgThe 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
argsChangeContentArgsConfiguration arguments for the transformation.
listList<string>The list of strings to transform.
funcFunc<string, TArg1, TArg2, string>The transformation function to apply to each element.
argument1TArg1The first argument to pass to the transformation function.
argument2TArg2The second argument to pass to the transformation function.
Returns
Type Parameters
TArg1The type of the first argument to pass to the transformation function.
TArg2The 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
listList<string>The list of strings to transform.
funcFunc<TArg, string, string>The transformation function with switched parameter order (argument first, then string).
argumentTArgThe argument to pass to the transformation function.
Returns
Type Parameters
TArgThe 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
argsChangeContentArgsConfiguration arguments for the transformation.
listList<string>The list of strings to transform.
predicatePredicate<string>The condition that determines which elements to transform.
funcFunc<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
argsChangeContentArgsConfiguration arguments for the transformation.
listList<string>The list of strings to transform.
funcFunc<string, TArg, string>The transformation function with normal parameter order (string first, then argument).
argumentTArgThe argument to pass to the transformation function.
funcSwitch12Func<TArg, string, string>Optional transformation function with switched parameter order (argument first, then string).
Returns
Type Parameters
TArgThe 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
argsChangeContentArgsConfiguration arguments for the transformation.
listList<string>The list of strings to transform.
funcFunc<string, TArg1, TArg2, string>The transformation function to apply to each element.
argument1TArg1The first argument to pass to the transformation function.
argument2TArg2The second argument to pass to the transformation function.
Returns
Type Parameters
TArg1The type of the first argument to pass to the transformation function.
TArg2The type of the second argument to pass to the transformation function.