budul.SetExtensions
1.11.0
See the version list below for details.
dotnet add package budul.SetExtensions --version 1.11.0
NuGet\Install-Package budul.SetExtensions -Version 1.11.0
<PackageReference Include="budul.SetExtensions" Version="1.11.0" />
<PackageVersion Include="budul.SetExtensions" Version="1.11.0" />
<PackageReference Include="budul.SetExtensions" />
paket add budul.SetExtensions --version 1.11.0
#r "nuget: budul.SetExtensions, 1.11.0"
#:package budul.SetExtensions@1.11.0
#addin nuget:?package=budul.SetExtensions&version=1.11.0
#tool nuget:?package=budul.SetExtensions&version=1.11.0
SetExtensions
Lightweight C# extension methods for working with collections of sets (IEnumerable<IEnumerable<T>>).
Supports .NET Standard 2.0/2.1 and .NET 7/8.
Quick overview
The library provides a set of public extension methods defined in SetExtensions.Extensions:
CartesianProduct<T>(this IEnumerable<IEnumerable<T>> sequences)
Produces the Cartesian product of a sequence of sequences. Each yielded item is anIEnumerable<T>representing one combination (one element from each input sequence).IsSubSetOf<T>(this IEnumerable<T> current, IEnumerable<T> other)
Tests whethercurrentis a multiset subset ofother. Duplicate counts are respected (uses lookups), so{1,1}is not a subset of{1}.IsSubSetOfOrOther<T>(this IEnumerable<T> current, IEnumerable<T> other)
Returns true if eithercurrentis a multiset subset ofotheror vice‑versa.Segmented<T>(this IEnumerable<IEnumerable<T>> sequences)
Splits the provided sets into non‑intersecting segments (disjoint groups). Useful to reduce overlapping sets into disjoint partitions.ToNeighborGroups<T, TKey>(this IEnumerable<IEnumerable<T>> sequences, Func<T, TKey> keySelector)
Produces groups of neighbor triplets(Previous, Current, Next)from the sequences using a combined strategy that clusters byCurrent(viakeySelector) and groups by best overlaps of previous/next elements. Useful for sequence-context grouping where you care about neighbor relations.Transponded<T>(this IEnumerable<IEnumerable<T>> sets)
Transposes the collection of sequences: returns the i-th elements across all input sequences as the i-th output sequence (similar to matrix transpose). If an input sequence is shorter,default(T)is used for missing positions.
Small usage examples
using SetExtensions;
// Cartesian product
var sets = new[] { new[] {1,2}, new[] {3,4} };
var product = sets.CartesianProduct();
// yields [1,3], [1,4], [2,3], [2,4]
// Subset
var a = new[] {1,1,2};
var b = new[] {1,1,2,3};
bool isSubset = a.IsSubSetOf(b);
// true
// Segmented
var sets = new[] { new[] {1,1,2}, new[] {1,1,2,3} };
var product = sets.Segmented();
// yields [1,1,2], [3]
// Transpose
var rows = new[] { new[] { "a","b" }, new[] { "c","d" } };
var cols = rows.Transponded();
// yields ["a","c"], ["b","d"]
// Neighbor groups (example uses string key)
var sequences = new[] { new[] { "a", "b" }, new[] { "a", "b", "c" } , new[] { "b", "c" }};
var groups = sequences.ToNeighborGroups(s => s);
// yields [["a","b", "c"], ["a","b",""], ["","b","c"]
Notes
License and contribution info: refer to the repository at https://github.com/budul100/SetExtensions.
| 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 is compatible. 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.14.0 | 405 | 11/20/2025 |
| 1.13.0 | 399 | 11/19/2025 |
| 1.12.0 | 398 | 11/18/2025 |
| 1.11.0 | 398 | 11/18/2025 |
| 1.10.0 | 370 | 6/29/2023 |
| 1.9.1 | 549 | 8/23/2022 |
| 1.9.0 | 541 | 8/23/2022 |
| 1.8.1 | 577 | 6/13/2022 |
| 1.8.0 | 581 | 6/13/2022 |
| 1.7.0 | 575 | 5/29/2021 |
| 1.6.0 | 620 | 10/11/2020 |
| 1.5.0 | 660 | 5/28/2020 |
| 1.4.0 | 657 | 5/28/2020 |
| 1.3.0 | 638 | 5/5/2020 |
| 1.2.0 | 633 | 5/5/2020 |
| 1.1.0 | 652 | 5/5/2020 |
| 1.0.0 | 645 | 5/5/2020 |