AStar.Dev.Functional.Extensions
0.1.4-alpha
This is a prerelease version of AStar.Dev.Functional.Extensions.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package AStar.Dev.Functional.Extensions --version 0.1.4-alpha
NuGet\Install-Package AStar.Dev.Functional.Extensions -Version 0.1.4-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AStar.Dev.Functional.Extensions" Version="0.1.4-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AStar.Dev.Functional.Extensions" Version="0.1.4-alpha" />
<PackageReference Include="AStar.Dev.Functional.Extensions" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AStar.Dev.Functional.Extensions --version 0.1.4-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AStar.Dev.Functional.Extensions, 0.1.4-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AStar.Dev.Functional.Extensions@0.1.4-alpha
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AStar.Dev.Functional.Extensions&version=0.1.4-alpha&prerelease
#tool nuget:?package=AStar.Dev.Functional.Extensions&version=0.1.4-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
๐ฏ Option<T> Functional Cheat Sheet
๐งฉ Option Overview
Represents a value that might exist (Some
) or not (None
), avoiding nulls and enabling functional composition.
Option<int> maybeNumber = Option.Some(42);
Option<string> emptyName = Option.None<string>();
๐ Construction
Syntax | Description |
---|---|
Option.Some(value) |
Wraps a non-null value as Some |
Option.None<T>() |
Creates a None of type T |
value.ToOption() |
Converts value or default to Option |
value.ToOption(predicate) |
Converts only if predicate returns true |
nullable.ToOption() |
Converts nullable struct to Option |
๐งช Pattern Matching
option.Match(
some => $"Value: {some}",
() => "No value"
);
Or via deconstruction:
var (isSome, value) = option;
Or with TryGet:
if (option.TryGetValue(out var value)) { /* use value */ }
๐ง Transformation
Method | Description |
---|---|
Map(func) |
Transforms value inside Some |
Bind(func) |
Chains function that returns another Option |
ToResult(errorFn) |
Converts Option to Result<T, TError> |
ToNullable() |
Converts to nullable (structs only) |
ToEnumerable() |
Converts to IEnumerable<T> |
๐ช LINQ Support
var result =
from name in Option.Some("Jason")
from greeting in Option.Some($"Hello, {name}")
select greeting;
Via Select
, SelectMany
, or SelectAwait
(async LINQ)
๐ Async Support
Method | Description |
---|---|
MapAsync(func) |
Awaits and maps value |
BindAsync(func) |
Awaits and chains async Option-returning func |
MatchAsync(onSome, onNone) |
Async pattern match |
SelectAwait(func) |
LINQ-friendly async projection |
๐งฏ Fallbacks and Conversions
option.OrElse("fallback"); // returns value or fallback
option.OrThrow(); // throws if None
option.IsSome(); // true if Some
option.IsNone(); // true if None
๐ Debugging & Output
option.ToString(); // Outputs "Some(value)" or "None"
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.2.2-alpha | 1 | 7/8/2025 |
0.1.4-alpha | 0 | 7/5/2025 |