LinqTools 5.1.1
See the version list below for details.
dotnet add package LinqTools --version 5.1.1
NuGet\Install-Package LinqTools -Version 5.1.1
<PackageReference Include="LinqTools" Version="5.1.1" />
paket add LinqTools --version 5.1.1
#r "nuget: LinqTools, 5.1.1"
// Install LinqTools as a Cake Addin #addin nuget:?package=LinqTools&version=5.1.1 // Install LinqTools as a Cake Tool #tool nuget:?package=LinqTools&version=5.1.1
LinqTools
Extensions for LINQ
Overview
- Extension functions to make Nullable a Monad/Functor
- Extension functions to make Async Function a Monad/Functor
- Ohter Tools usable for fluent syntax
Option< T >
There are Extension Functions for Option to make them Monads/Functors:
- Select
- SelectMany
If you are not sure, if an object is null although the compiler says no, you can create a Nullable from an apparently not Nullable with
static T? AsNullable<T>(this T t)
With the extension functions you can work with Options as if they were the containing type:
var res = (from n in teststr
from m in GetFirstStringChecked(n)
where m.Length == 9
from p in ThrowIfNull(m)
select p)
.GetOrDefault("Nothing");
As soon as a function returns None, all further processing is skipped.
Result Monad/Functor
There is a Result Monad/Functor, containing either an Ok value or an Error value. You can transform Results with LINQ queries like:
var test = from n in await Process.RunAsync("lsblk", "--bytes --output SIZE,NAME,LABEL,MOUNTPOINT,FSTYPE")
let driveLines = n.Split('\n', StringSplitOptions.RemoveEmptyEntries)
let titles = driveLines[0]
let positions = new[]
{
0,
titles.IndexOf("NAME"),
titles.IndexOf("LABEL"),
titles.IndexOf("MOUNT"),
titles.IndexOf("FSTYPE")
}
select driveLines
.Skip(1)
.Select(n => CreateRootItem(n, positions))
.ToArray();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- System.Linq.Async (>= 6.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LinqTools:
Package | Downloads |
---|---|
GtkDotNet
.NET 6 Bindings for GTK 3 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.2.0 | 231 | 12/13/2023 |
6.1.0 | 158 | 12/13/2023 |
6.0.0 | 292 | 12/10/2023 |
5.5.0 | 811 | 11/18/2023 |
5.4.0 | 483 | 11/16/2023 |
5.3.0 | 893 | 11/11/2023 |
5.2.0 | 872 | 8/14/2023 |
5.1.1 | 385 | 8/12/2023 |
5.1.0 | 388 | 8/12/2023 |
5.0.0 | 833 | 8/10/2023 |
4.2.0 | 200 | 8/9/2023 |
4.1.0 | 294 | 4/24/2023 |
4.0.0 | 951 | 4/9/2023 |
3.3.0 | 601 | 4/8/2023 |
3.2.0 | 206 | 4/8/2023 |
3.1.0 | 223 | 4/8/2023 |
3.0.0 | 202 | 4/8/2023 |
2.0.0 | 296 | 3/28/2023 |
1.3.0 | 264 | 3/26/2023 |
1.2.0 | 1,706 | 3/18/2023 |
1.1.0 | 430 | 3/15/2023 |
1.0.0 | 965 | 3/11/2023 |
0.0.1-alpha.5 | 108 | 3/8/2023 |
0.0.1-alpha.4 | 101 | 3/8/2023 |
0.0.1-alpha.3 | 92 | 3/8/2023 |
0.0.1-alpha.2 | 91 | 3/8/2023 |
0.0.1-alpha.1 | 92 | 3/8/2023 |
Instead of Nullables use Option