Class FunctionalExtensions
Functional programming extension methods.
Inherited Members
Namespace: Swan
Syntax
public static class FunctionalExtensions
Methods
AddRangeWhen<T>(List<T>, Func<Boolean>, Func<IEnumerable<T>>)
Adds the range when the condition is true.
Declaration
public static List<T> AddRangeWhen<T>(this List<T> list, Func<bool> condition, Func<IEnumerable<T>> value)
Parameters
Type | Name | Description |
---|---|---|
List<T> | list | The list. |
Func<Boolean> | condition | The condition. |
Func<IEnumerable<T>> | value | The value. |
Returns
Type | Description |
---|---|
List<T> | The List. |
Type Parameters
Name | Description |
---|---|
T | The type of List element. |
AddWhen<T>(IList<T>, Func<Boolean>, Func<T>)
Adds the value when the condition is true.
Declaration
public static IList<T> AddWhen<T>(this IList<T> list, Func<bool> condition, Func<T> value)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list. |
Func<Boolean> | condition | The condition. |
Func<T> | value | The value. |
Returns
Type | Description |
---|---|
IList<T> | The IList. |
Type Parameters
Name | Description |
---|---|
T | The type of IList element. |
AddWhen<T>(IList<T>, Boolean, T)
Adds the value when the condition is true.
Declaration
public static IList<T> AddWhen<T>(this IList<T> list, bool condition, T value)
Parameters
Type | Name | Description |
---|---|---|
IList<T> | list | The list. |
Boolean | condition | if set to |
T | value | The value. |
Returns
Type | Description |
---|---|
IList<T> | The IList. |
Type Parameters
Name | Description |
---|---|
T | The type of IList element. |
When<T>(IEnumerable<T>, Func<Boolean>, Func<IEnumerable<T>, IEnumerable<T>>)
Whens the specified condition.
Declaration
public static IEnumerable<T> When<T>(this IEnumerable<T> list, Func<bool> condition, Func<IEnumerable<T>, IEnumerable<T>> fn)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | list | The list. |
Func<Boolean> | condition | The condition. |
Func<IEnumerable<T>, IEnumerable<T>> | fn | The function. |
Returns
Type | Description |
---|---|
IEnumerable<T> | The IEnumerable. |
Type Parameters
Name | Description |
---|---|
T | The type of IEnumerable. |
When<T>(IQueryable<T>, Func<Boolean>, Func<IQueryable<T>, IQueryable<T>>)
Whens the specified condition.
Declaration
public static IQueryable<T> When<T>(this IQueryable<T> list, Func<bool> condition, Func<IQueryable<T>, IQueryable<T>> fn)
Parameters
Type | Name | Description |
---|---|---|
IQueryable<T> | list | The list. |
Func<Boolean> | condition | The condition. |
Func<IQueryable<T>, IQueryable<T>> | fn | The function. |
Returns
Type | Description |
---|---|
IQueryable<T> | The IQueryable. |
Type Parameters
Name | Description |
---|---|
T | The type of IQueryable. |