Chasm.Collections
2.4.3
See the version list below for details.
dotnet add package Chasm.Collections --version 2.4.3
NuGet\Install-Package Chasm.Collections -Version 2.4.3
<PackageReference Include="Chasm.Collections" Version="2.4.3" />
paket add Chasm.Collections --version 2.4.3
#r "nuget: Chasm.Collections, 2.4.3"
// Install Chasm.Collections as a Cake Addin #addin nuget:?package=Chasm.Collections&version=2.4.3 // Install Chasm.Collections as a Cake Tool #tool nuget:?package=Chasm.Collections&version=2.4.3
Chasm.Collections
Provides various collection-related extension and utility methods.
ArrayExtensions
Contains extension versions of most static methods in the Array
class.
int[] numbers = new int[10] { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 };
int index = numbers.IndexOf(8);
string[] strings = numbers.ConvertAll(num => num.ToString());
string? found = strings.Find(s => s.Length > 1);
Includes overloads of Find
, Exists
, ConvertAll
and other methods that use delegates, that provide one or two extra parameters - the element's index and the source array. Similar to how it works in JavaScript arrays.
string[] distinct = strings.FindAll((el, i, arr) => i == arr.IndexOf(el));
Also includes some common LINQ methods optimized for arrays: Cast
, OfType
and Contains
. And Copy
for simpler shallow copying.
object[] arr = new object[] { "Hello", "World", "!" };
string[] strings = arr.Cast<string>();
object[] shallowCopy = arr.Copy();
CollectionExtensions
Contains Add
overloads for adding tuples and KeyValuePair
s to collections, without having to enclose the elements in double parenthesis.
List<(string, double)> units = new();
units.Add("meter", 1);
units.Add("centimeter", 0.01);
EnumerableExtensions
Contains NotNull
, ForEach
, EmptyIfNull
and Join
extension methods for enumerables.
string?[] values = new string?[] { "Hello", null, "World", null, "!" };
Console.WriteLine(values.NotNull().Join(", "));
// Output: Hello, World, !
Enumerator
, ReadOnlyCollection
, ReadOnlyDictionary
Contain static Empty<T>()
methods that returns a global empty enumerator/read-only collection/read-only dictionary.
if (size == 0) return ReadOnlyCollection.Empty<string>();
/* ... */
Enumerator
contains three versions of this method: Empty()
(IEnumerator
), Empty<T>()
(IEnumerator<T>
) and EmptyAsync<T>()
(IAsyncEnumerator<T>
).
[!NOTE] .NET 8 introduced
ReadOnlyCollection<T>.Empty
andReadOnlyDictionary<TKey, TValue>.Empty
properties, so, you could use them instead if you're only targeting the newer versions. Chasm.Collections will also use them when compiled for .NET 8 and newer.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 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 is compatible. |
.NET Core | netcoreapp1.0 is compatible. netcoreapp1.1 was computed. netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.0 is compatible. netstandard1.1 was computed. netstandard1.2 was computed. netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. 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 | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wp8 was computed. wp81 was computed. wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 1.0
- Microsoft.NETCore.App (>= 1.0.5)
-
.NETCoreApp 2.0
- No dependencies.
-
.NETCoreApp 3.0
- No dependencies.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETStandard 1.0
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.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 |
---|---|---|
2.4.4 | 37 | 11/19/2024 |
2.4.3 | 91 | 9/28/2024 |
2.4.2 | 140 | 9/15/2024 |
2.4.1 | 106 | 9/6/2024 |
2.4.0 | 99 | 9/5/2024 |
2.3.1 | 125 | 8/25/2024 |
2.3.0 | 123 | 8/19/2024 |
2.2.7 | 97 | 6/11/2024 |
2.2.6 | 96 | 6/7/2024 |
2.2.5 | 94 | 5/12/2024 |
2.2.4 | 97 | 5/9/2024 |
2.2.2 | 342 | 1/1/2024 |
2.2.1 | 154 | 12/17/2023 |
2.2.0 | 131 | 12/17/2023 |
2.1.0 | 149 | 12/16/2023 |
2.0.0 | 135 | 12/16/2023 |