Simple optional types with basic helpers
$ dotnet add package AInq.Optional
Simple optional types with basic helpers and converters
Maybe<T> value or nothingTry<T> value or errorEither<TLeft, TRight> value either value
AInq.Optional - Types and basic helpers
AInq.Optional.Async - Async helpers and extensions
Some Maybe LINQ extensions renamed to avoid ambiguity with other libs with similar functions. Current method names saved as aliases and marked as and will be removed in next major release.
Renamed method groups:
IEnumerable.FirstOrNone -> IEnumerable.MaybeFirstIEnumerable.LastOrNone -> IEnumerable.MaybeLastIEnumerable.SingleOrNone -> IEnumerable.MaybeSingleIEnumerable.FirstOrNoneNotNull -> IEnumerable.MaybeFirstNotNullIEnumerable.LastOrNoneNotNull -> IEnumerable.MaybeLastNotNullIEnumerable.SingleOrNoneNotNull -> IEnumerable.MaybeSingleNotNullLarge refactoring and internal optimization with some breaking changes
System.Linq is used for collection extensions, which may cause minor behavior changesSystem.Linq.AsyncEnumerable is used in .net10 with minor API changesMaybe.AsTry to Maybe.TryValueTry.AsMaybe to Try.MaybeValueMaybe.Or to Maybe.EitherValuebool cast operators explicitTry<T> extensions, which can implicitly hide exceptionsTry.MaybeValue now throw exception if source is not success, introduced flag to suppress thisTry<T>| (or) operator for Maybe<T>! (not) operator for Maybe<T> and Try<T>! (invert) operator for Either<TLeft, TRight>Maybe.Values collection extension with filteringTry.Result with additional generator parameterFor version 3.0 this lib was completely rewritten with some breaking changes
class instead of structIComparable implementation (problems with comparing null and empty item)Try.SelectOrDefault and Try.ValueOrDefault (implicitly hides error, can be replaced with Try.AsMaybe)ValueTask and moved to separate packageIf you find a bug, have a question or something else - you are friendly welcome to open an issue.
Copyright © 2021 Anton Andryushchenko. AInq.Optional is licensed under Apache License 2.0