├── .config
└── dotnet-tools.json
├── .devcontainer
├── README.md
└── devcontainer.json
├── .editorconfig
├── .gitattributes
├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── COPYING.txt
├── Directory.Build.props
├── MoreLinq.Test.Aot
├── MoreLinq.Test.Aot.csproj
└── ToDataTableTest.cs
├── MoreLinq.Test
├── .editorconfig
├── AcquireTest.cs
├── AggregateRightTest.cs
├── AggregateTest.cs
├── AppendTest.cs
├── AssertCountTest.cs
├── AssertTest.cs
├── Async
│ ├── AsyncEnumerable.cs
│ ├── MergeTest.cs
│ ├── TestExtensions.cs
│ ├── TestingAsyncSequence.cs
│ └── WatchableEnumerator.cs
├── AtLeastTest.cs
├── AtMostTest.cs
├── BacksertTest.cs
├── BatchTest.cs
├── BreakingAction.cs
├── BreakingCollection.cs
├── BreakingFunc.cs
├── BreakingList.cs
├── BreakingReadOnlyCollection.cs
├── BreakingReadOnlyList.cs
├── BreakingSequence.cs
├── CartesianTest.cs
├── ChooseTest.cs
├── Combinatorics.cs
├── Comparable.cs
├── CompareCountTest.cs
├── ConsumeTest.cs
├── CountBetweenTest.cs
├── CountByTest.cs
├── CountDownTest.cs
├── CurrentThreadCultureScope.cs
├── DistinctByTest.cs
├── DuplicatesTest.cs
├── EndsWithTest.cs
├── Enumerable.cs
├── EqualityComparer.cs
├── EquiZipTest.cs
├── EvaluateTest.cs
├── ExactlyTest.cs
├── ExceptByTest.cs
├── ExcludeTest.cs
├── Extensions.cs
├── FallbackIfEmptyTest.cs
├── FillBackwardTest.cs
├── FillForwardTest.cs
├── FlattenTest.cs
├── FoldTest.cs
├── ForEachTest.cs
├── FromTest.cs
├── FullGroupJoinTest.cs
├── FullJoinTest.cs
├── FuncModule.cs
├── GenerateTest.cs
├── GroupAdjacentTest.cs
├── IndexByTest.cs
├── IndexTest.cs
├── InsertTest.cs
├── InterleaveTest.cs
├── KeyValuePair.cs
├── LagTest.cs
├── LeadTest.cs
├── LeftJoinTest.cs
├── Make.cs
├── MaximaTest.cs
├── MemoizeTest.cs
├── MinimaTest.cs
├── MoreLinq.Test.csproj
├── MoveTest.cs
├── NullArgumentTest.cs
├── OrderByTest.cs
├── OrderedMergeTest.cs
├── PadStartTest.cs
├── PadTest.cs
├── PairwiseTest.cs
├── PartialSortByTest.cs
├── PartialSortTest.cs
├── PartitionTest.cs
├── PermutationsTest.cs
├── PipeTest.cs
├── PreScanTest.cs
├── PrependTest.cs
├── Program.cs
├── RandomSubsetTest.cs
├── RandomTest.cs
├── RankTest.cs
├── ReadOnlyCollection.cs
├── RepeatTest.cs
├── ReturnTest.cs
├── RightJoinTest.cs
├── RunLengthEncodeTest.cs
├── SampleData.cs
├── ScanByTest.cs
├── ScanRightTest.cs
├── ScanTest.cs
├── Scope.cs
├── SegmentTest.cs
├── SequenceReader.cs
├── SequenceTest.cs
├── ShuffleTest.cs
├── SkipLastTest.cs
├── SkipLastWhileTest.cs
├── SkipUntilTest.cs
├── SliceTest.cs
├── SortedMergeTest.cs
├── SplitTest.cs
├── StartsWithTest.cs
├── SubjectTest.cs
├── SubsetTest.cs
├── TagFirstLastTest.cs
├── TakeEveryTest.cs
├── TakeLastTest.cs
├── TakeUntilTest.cs
├── TestException.cs
├── TestExtensions.cs
├── TestingSequence.cs
├── Throws.cs
├── ToArrayByIndexTest.cs
├── ToDataTableTest.cs
├── ToDelimitedStringTest.cs
├── ToDictionaryTest.cs
├── ToLookupTest.cs
├── TraceTest.cs
├── TransposeTest.cs
├── TraverseTest.cs
├── TrySingleTest.cs
├── UnfoldTest.cs
├── WatchableEnumerator.cs
├── WindowLeftTest.cs
├── WindowRightTest.cs
├── WindowTest.cs
├── ZipLongestTest.cs
├── ZipShortestTest.cs
└── coverlet.runsettings
├── MoreLinq.shfbproj
├── MoreLinq.sln
├── MoreLinq
├── Acquire.cs
├── Aggregate.g.cs
├── Aggregate.g.tt
├── AggregateRight.cs
├── Append.cs
├── AssemblyInfo.cs
├── Assert.cs
├── AssertCount.cs
├── Assume.cs
├── Backsert.cs
├── Batch.cs
├── Cartesian.g.cs
├── Cartesian.g.tt
├── Choose.cs
├── CollectionLike.cs
├── Collections
│ └── Dictionary.cs
├── CompatibilitySuppressions.xml
├── Consume.cs
├── CountBy.cs
├── CountDown.cs
├── CountMethods.cs
├── Debug.cs
├── Delegating.cs
├── Disposable.cs
├── DistinctBy.cs
├── Duplicates.cs
├── EndsWith.cs
├── EquiZip.cs
├── Evaluate.cs
├── ExceptBy.cs
├── Exclude.cs
├── Experimental
│ ├── Aggregate.cs
│ ├── Async
│ │ ├── ExperimentalEnumerable.cs
│ │ └── Merge.cs
│ ├── Await.cs
│ ├── Batch.cs
│ ├── CurrentBuffer.cs
│ ├── ExperimentalEnumerable.cs
│ ├── Memoize.cs
│ └── TrySingle.cs
├── Extensions.ToDataTable.g.cs
├── Extensions.g.cs
├── ExtremaMembers.cs
├── FallbackIfEmpty.cs
├── FillBackward.cs
├── FillForward.cs
├── Flatten.cs
├── Fold.cs
├── Fold.g.cs
├── Fold.g.tt
├── ForEach.cs
├── From.cs
├── FullGroupJoin.cs
├── FullJoin.cs
├── Generate.cs
├── GenerateByIndex.cs
├── GlobalRandom.cs
├── GroupAdjacent.cs
├── IdFn.cs
├── Index.cs
├── IndexBy.cs
├── Insert.cs
├── Interleave.cs
├── Lag.cs
├── Lead.cs
├── LeftJoin.cs
├── ListLike.cs
├── Lock.cs
├── Lookup.cs
├── MaxBy.cs
├── Maxima.cs
├── MinBy.cs
├── Minima.cs
├── MoreEnumerable.cs
├── MoreLinq.csproj
├── Move.cs
├── OrderBy.cs
├── OrderByDirection.cs
├── OrderedMerge.cs
├── Pad.cs
├── PadStart.cs
├── Pairwise.cs
├── PartialSort.cs
├── Partition.cs
├── PendNode.cs
├── Permutations.cs
├── Pipe.cs
├── PreScan.cs
├── Prepend.cs
├── PublicAPI
│ ├── net8.0
│ │ ├── PublicAPI.Shipped.txt
│ │ └── PublicAPI.Unshipped.txt
│ ├── net9.0
│ │ ├── PublicAPI.Shipped.txt
│ │ └── PublicAPI.Unshipped.txt
│ ├── netstandard2.0
│ │ ├── PublicAPI.Shipped.txt
│ │ └── PublicAPI.Unshipped.txt
│ └── netstandard2.1
│ │ ├── PublicAPI.Shipped.txt
│ │ └── PublicAPI.Unshipped.txt
├── Random.cs
├── RandomSubset.cs
├── Rank.cs
├── Reactive
│ ├── Observable.cs
│ └── Subject.cs
├── Repeat.cs
├── Return.cs
├── ReverseComparer.cs
├── RightJoin.cs
├── RunLengthEncode.cs
├── Scan.cs
├── ScanBy.cs
├── ScanRight.cs
├── Segment.cs
├── Sequence.cs
├── SequenceException.cs
├── Shuffle.cs
├── SkipLast.cs
├── SkipLastWhile.cs
├── SkipUntil.cs
├── Slice.cs
├── SortedMerge.cs
├── Split.cs
├── StartsWith.cs
├── Subsets.cs
├── TagFirstLast.cs
├── TakeEvery.cs
├── TakeLast.cs
├── TakeUntil.cs
├── ToArrayByIndex.cs
├── ToDataTable.cs
├── ToDelimitedString.cs
├── ToDelimitedString.g.cs
├── ToDelimitedString.g.tt
├── ToDictionary.cs
├── ToHashSet.cs
├── ToLookup.cs
├── Trace.cs
├── Transpose.cs
├── Traverse.cs
├── Unfold.cs
├── UnreachableException.cs
├── Window.cs
├── WindowLeft.cs
├── WindowRight.cs
├── ZipImpl.cs
├── ZipLongest.cs
├── ZipShortest.cs
├── key.snk
├── tt.cmd
└── tt.sh
├── README.md
├── appveyor.yml
├── bld
├── Copyright.props
└── ExtensionsGenerator
│ ├── .editorconfig
│ ├── MoreLinq.ExtensionsGenerator.csproj
│ └── Program.cs
├── build.cmd
├── build.sh
├── builddocs.cmd
├── eclint.ps1
├── global.json
├── msbuild.cmd
├── pack.cmd
├── pack.sh
├── test.cmd
├── test.sh
└── tools
├── dotnet-install.ps1
├── dotnet-install.sh
├── mark-shipped.cmd
└── mark-shipped.ps1
/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "dotnet-t4": {
6 | "version": "3.0.0",
7 | "commands": [
8 | "t4"
9 | ],
10 | "rollForward": false
11 | },
12 | "dotnet-reportgenerator-globaltool": {
13 | "version": "5.3.9",
14 | "commands": [
15 | "reportgenerator"
16 | ],
17 | "rollForward": false
18 | },
19 | "meziantou.framework.nugetpackagevalidation.tool": {
20 | "version": "1.0.16",
21 | "commands": [
22 | "meziantou.validate-nuget-package"
23 | ],
24 | "rollForward": false
25 | },
26 | "powershell": {
27 | "version": "7.4.5",
28 | "commands": [
29 | "pwsh"
30 | ],
31 | "rollForward": false
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/.devcontainer/README.md:
--------------------------------------------------------------------------------
1 | # Dev Container
2 |
3 | [](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/morelinq/MoreLINQ)
4 |
5 | For a consistent development experience, you can use [Visual Studio Code] with
6 | the [Dev Containers extension]. A [dev container] provides a ready-to-use
7 | development environment with all the necessary dependencies.
8 |
9 | To use [the dev container]:
10 |
11 | 1. Install [Visual Studio Code]
12 | 2. Install the [Dev Containers extension]
13 | 3. Clone the repository and open it in VS Code
14 | 4. When prompted, click **Reopen in Container** or run the **Dev Containers:
15 | Reopen in Container** command
16 |
17 | Alternatively, you can use [GitHub Codespaces] to develop in the cloud without
18 | installing anything locally. Simply click the **Code** button in [the GitHub
19 | repository] and select **Open with Codespaces** to get started with the same
20 | development environment.
21 |
22 | The dev container uses an Ubuntu-based image and automatically installs:
23 |
24 | - .NET SDK based on the version in [`global.json`]
25 | - Supported .NET runtimes targets for testing
26 | - Git and GitHub CLI
27 | - All necessary VS Code extensions for .NET development
28 |
29 | Once the container environment is up and running, build and test the solution by
30 | executing:
31 |
32 | ```sh
33 | ./test.sh
34 | ```
35 |
36 | [`global.json`]: ../global.json
37 | [dev container]: https://containers.dev/
38 | [the dev container]: devcontainer.json
39 | [Visual Studio Code]: https://code.visualstudio.com/
40 | [Dev Containers extension]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
41 | [GitHub Codespaces]: https://github.com/features/codespaces
42 | [the GitHub repository]: https://github.com/morelinq/MoreLINQ
43 |
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "MoreLINQ",
3 | "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
4 | "customizations": {
5 | "vscode": {
6 | "extensions": [
7 | "ms-dotnettools.csdevkit",
8 | "ms-dotnettools.csharp",
9 | "ms-dotnettools.vscode-dotnet-runtime",
10 | "editorconfig.editorconfig",
11 | "github.copilot",
12 | "streetsidesoftware.code-spell-checker"
13 | ],
14 | "settings": {
15 | "dotnet.defaultSolution": "MoreLinq.sln",
16 | "editor.formatOnSave": true,
17 | "omnisharp.enableRoslynAnalyzers": true,
18 | "omnisharp.enableEditorConfigSupport": true
19 | }
20 | }
21 | },
22 | "features": {
23 | "ghcr.io/devcontainers/features/git:1": {
24 | "version": "latest"
25 | },
26 | "ghcr.io/devcontainers/features/github-cli:1": {
27 | "version": "latest"
28 | },
29 | "ghcr.io/devcontainers/features/dotnet:2": {
30 | "version": "9.0.300",
31 | "dotnetRuntimeVersions": "8.0.14"
32 | },
33 | "ghcr.io/devcontainers/features/common-utils:2": {
34 | "installZsh": false,
35 | "configureZshAsDefaultShell": false,
36 | "installOhMyZsh": false,
37 | "username": "vscode",
38 | "userUid": "1000",
39 | "userGid": "1000",
40 | "upgradePackages": true
41 | }
42 | },
43 | "postCreateCommand": "dotnet restore",
44 | "remoteUser": "vscode"
45 | }
46 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | *.sh eol=lf
5 |
6 | # Custom for Visual Studio
7 | *.cs diff=csharp
8 |
9 | # Standard to msysgit
10 | *.doc diff=astextplain
11 | *.DOC diff=astextplain
12 | *.docx diff=astextplain
13 | *.DOCX diff=astextplain
14 | *.dot diff=astextplain
15 | *.DOT diff=astextplain
16 | *.pdf diff=astextplain
17 | *.PDF diff=astextplain
18 | *.rtf diff=astextplain
19 | *.RTF diff=astextplain
20 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | 13
4 | enable
5 | true
6 | 8.0-all
7 | true
8 |
9 | EnableGenerateDocumentationFile
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MoreLinq.Test.Aot/MoreLinq.Test.Aot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net9.0;net8.0
5 | exe
6 | false
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | all
20 | runtime; build; native; contentfiles; analyzers; buildtransitive
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/MoreLinq.Test/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # CA1034: Nested types should not be visible
4 | dotnet_diagnostic.CA1034.severity = none
5 |
6 | # CA1062: Validate arguments of public methods
7 | dotnet_diagnostic.CA1062.severity = none
8 |
9 | # CA1825: Avoid zero-length array allocations
10 | dotnet_diagnostic.CA1825.severity = suggestion
11 |
12 | # CA1032: Implement standard exception constructors
13 | dotnet_diagnostic.CA1032.severity = none
14 |
15 | # CA1064: Exceptions should be public
16 | dotnet_diagnostic.CA1064.severity = none
17 |
18 | # CA1303: Do not pass literals as localized parameters
19 | dotnet_diagnostic.CA1303.severity = none
20 |
21 | # CA5394: Do not use insecure randomness
22 | dotnet_diagnostic.CA5394.severity = none
23 |
24 | # CA1707: Identifiers should not contain underscores
25 | dotnet_diagnostic.CA1707.severity = none
26 |
27 | # CA1308: Normalize strings to uppercase
28 | dotnet_diagnostic.CA1308.severity = none
29 |
30 | # CA2007: Consider calling ConfigureAwait on the awaited task
31 | dotnet_diagnostic.CA2007.severity = suggestion
32 |
33 | # IDE0047: Remove unnecessary parentheses
34 | dotnet_diagnostic.IDE0047.severity = suggestion
35 |
36 | [*{Test,Tests}.cs]
37 |
38 | # CA1861: Avoid constant arrays as arguments
39 | dotnet_diagnostic.CA1861.severity = none
40 |
41 | # IDE0022: Use expression/block body for methods
42 | dotnet_diagnostic.IDE0022.severity = none
43 |
--------------------------------------------------------------------------------
/MoreLinq.Test/AcquireTest.cs:
--------------------------------------------------------------------------------
1 | #region License and Terms
2 | // MoreLINQ - Extensions to LINQ to Objects
3 | // Copyright (c) 2012 Atif Aziz. All rights reserved.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | #endregion
17 |
18 | namespace MoreLinq.Test
19 | {
20 | using System;
21 | using NUnit.Framework;
22 |
23 | [TestFixture]
24 | public class AcquireTest
25 | {
26 | [Test]
27 | public void AcquireAll()
28 | {
29 | Disposable? a = null;
30 | Disposable? b = null;
31 | Disposable? c = null;
32 |
33 | var allocators = MoreEnumerable.From(() => a = new Disposable(),
34 | () => b = new Disposable(),
35 | () => c = new Disposable());
36 |
37 | var disposables = allocators.Acquire();
38 |
39 | Assert.That(disposables.Length, Is.EqualTo(3));
40 |
41 | foreach (var disposable in disposables.ZipShortest([a, b, c], (act, exp) => new { Actual = act, Expected = exp }))
42 | {
43 | Assert.That(disposable.Actual, Is.SameAs(disposable.Expected));
44 | Assert.That(disposable.Actual.Disposed, Is.False);
45 | }
46 | }
47 |
48 | [Test]
49 | public void AcquireSome()
50 | {
51 | Disposable? a = null;
52 | Disposable? b = null;
53 | Disposable? c = null;
54 |
55 | var allocators = MoreEnumerable.From(() => a = new Disposable(),
56 | () => b = new Disposable(),
57 | () => throw new TestException(),
58 | () => c = new Disposable());
59 |
60 | Assert.That(allocators.Acquire, Throws.TypeOf());
61 |
62 | Assert.That(a, Is.Not.Null);
63 | Assert.That(a.Disposed, Is.True);
64 | Assert.That(b, Is.Not.Null);
65 | Assert.That(b.Disposed, Is.True);
66 | Assert.That(c, Is.Null);
67 | }
68 |
69 | sealed class Disposable : IDisposable
70 | {
71 | public bool Disposed { get; private set; }
72 | public void Dispose() => Disposed = true;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/MoreLinq.Test/AssertTest.cs:
--------------------------------------------------------------------------------
1 | #region License and Terms
2 | // MoreLINQ - Extensions to LINQ to Objects
3 | // Copyright (c) 2013 Atif Aziz. All rights reserved.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | #endregion
17 |
18 | namespace MoreLinq.Test
19 | {
20 | using System;
21 | using NUnit.Framework;
22 |
23 | [TestFixture]
24 | public class AssertTest
25 | {
26 | [Test]
27 | public void AssertIsLazy()
28 | {
29 | _ = new BreakingSequence