Summary
provides a mechanism to use Single on a collection that returns a discriminated union instead of an exception.
- Namespace
- FunctionalSharp
.DiscriminatedUnions - Containing Type
- LinqExtensions
Syntax
public static DiscriminatedUnion<T, MultipleResultsException, EmptySequenceException> SafeSingle<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
Type Parameters
Name | Description |
---|---|
T |
Parameters
Name | Type | Description |
---|---|---|
sequence | IEnumerable |
|
predicate | Func |
Return Value
Type | Description |
---|---|
DiscriminatedUnion |