{"id":19190336,"url":"https://github.com/uriegel/linqtools","last_synced_at":"2025-07-29T03:08:52.650Z","repository":{"id":142262016,"uuid":"611449128","full_name":"uriegel/LinqTools","owner":"uriegel","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-14T07:39:37.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T02:06:35.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uriegel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-08T21:10:40.000Z","updated_at":"2023-03-08T21:10:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"f302b91e-bfb2-4ddb-8c5b-b746fdd3d8bc","html_url":"https://github.com/uriegel/LinqTools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uriegel/LinqTools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uriegel%2FLinqTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uriegel%2FLinqTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uriegel%2FLinqTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uriegel%2FLinqTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uriegel","download_url":"https://codeload.github.com/uriegel/LinqTools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uriegel%2FLinqTools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267621605,"owners_count":24116901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T11:33:55.048Z","updated_at":"2025-07-29T03:08:52.617Z","avatar_url":"https://github.com/uriegel.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LinqTools\n\nExtensions for LINQ\n\n## Overview\n\n* Extension functions to make Nullable a Monad/Functor\n* Extension functions to make Async Function a Monad/Functor\n* Ohter Tools usable for fluent syntax\n\n## Option\u003c T \u003e\n\nThere are Extension Functions for Option to make them Monads/Functors:\n* Select\n* SelectMany\n\nIf 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\n```\nstatic T? AsNullable\u003cT\u003e(this T t)\n\n``` \nWith the extension functions you can work with Options as if they were the containing type:\n``` \nvar res = (from n in teststr\n           from m in GetFirstStringChecked(n) \n           where m.Length == 9\n           from p in ThrowIfNull(m)\n           select p)\n                .GetOrDefault(\"Nothing\");\n``` \nAs soon as a function returns None, all further processing is skipped.\n\n## Result Monad/Functor\n\nThere is a Result Monad/Functor, containing either an Ok value or an Error value. You can transform\nResults with LINQ queries like:\n\n```\nvar test = from n in await Process.RunAsync(\"lsblk\", \"--bytes --output SIZE,NAME,LABEL,MOUNTPOINT,FSTYPE\")\n           let driveLines = n.Split('\\n', StringSplitOptions.RemoveEmptyEntries)\n           let titles = driveLines[0]\n           let positions = new[]\n           {\n               0,\n               titles.IndexOf(\"NAME\"),\n               titles.IndexOf(\"LABEL\"),\n               titles.IndexOf(\"MOUNT\"),\n               titles.IndexOf(\"FSTYPE\")\n           }\n           select driveLines\n                    .Skip(1)\n                    .Select(n =\u003e CreateRootItem(n, positions))\n                    .ToArray();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furiegel%2Flinqtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furiegel%2Flinqtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furiegel%2Flinqtools/lists"}