Class IEnumerableExtensions
IEnumerable<T> extension methods.
Namespace: Neon.Common
Assembly: Neon.Common.dll
Syntax
public static class IEnumerableExtensions
Methods
IsEmpty<T>(IEnumerable<T>, Func<T, bool>)
Determines whether an IEnumerable is empty.
Declaration
public static bool IsEmpty<T>(this IEnumerable<T> items, Func<T, bool> predicate = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The items to be tested. |
Func<T, bool> | predicate | Optional item selector. |
Returns
Type | Description |
---|---|
bool |
|
Type Parameters
Name | Description |
---|---|
T | The enumeration value type. |
SelectRandom<T>(IEnumerable<T>, int)
Selects one or more randomly selected items from an enumeration.
Declaration
public static IEnumerable<T> SelectRandom<T>(this IEnumerable<T> items, int count = 1)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The source items. |
int | count | The number of values to be returned (defaults to 1. |
Returns
Type | Description |
---|---|
IEnumerable<T> | The randomly selected items as an enumeration. |
Type Parameters
Name | Description |
---|---|
T | The value type. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |