{"id":15561447,"url":"https://github.com/jeevanjames/collections","last_synced_at":"2025-04-23T22:41:31.853Z","repository":{"id":48575276,"uuid":"161940876","full_name":"JeevanJames/Collections","owner":"JeevanJames","description":"Collection extensions and custom collections for .NET.","archived":false,"fork":false,"pushed_at":"2023-12-30T06:52:27.000Z","size":345,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T03:25:57.480Z","etag":null,"topics":["collection","collections","collections-framework","extension-methods","extensions"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JeevanJames.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":"2018-12-15T20:22:53.000Z","updated_at":"2024-02-10T08:09:02.000Z","dependencies_parsed_at":"2023-12-13T22:05:33.989Z","dependency_job_id":"49c4edfc-6b32-4c0c-ab41-3c4d981564c7","html_url":"https://github.com/JeevanJames/Collections","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2FCollections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2FCollections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2FCollections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JeevanJames%2FCollections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JeevanJames","download_url":"https://codeload.github.com/JeevanJames/Collections/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528683,"owners_count":21445511,"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","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":["collection","collections","collections-framework","extension-methods","extensions"],"created_at":"2024-10-02T16:08:13.583Z","updated_at":"2025-04-23T22:41:31.814Z","avatar_url":"https://github.com/JeevanJames.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collections.NET [![Build status](https://img.shields.io/appveyor/ci/JeevanJames/collections.svg)](https://ci.appveyor.com/project/JeevanJames/collections/branch/master) [![Test status](https://img.shields.io/appveyor/tests/JeevanJames/collections.svg)](https://ci.appveyor.com/project/JeevanJames/collections/branch/master) [![codecov](https://codecov.io/gh/JeevanJames/Collections/branch/master/graph/badge.svg)](https://codecov.io/gh/JeevanJames/Collections) [![NuGet Version](http://img.shields.io/nuget/v/Collections.NET.svg?style=flat)](https://www.nuget.org/packages/Collections.NET/) [![NuGet Downloads](https://img.shields.io/nuget/dt/Collections.NET.svg)](https://www.nuget.org/packages/Collections.NET/)\n\nCollections.NET is a set of collection extensions and custom collections.\n\nAll code in this package is under the `System.Collections.Generic` namespace, so you automatically have access to the extension methods simply by using the namespace.\n\n## Nuget installation\nInstall using package manager:\n```ps\nPM\u003e Install-Package Collections.NET\n```\n\nInstall using `dotnet` CLI:\n```sh\n\u003e dotnet add package Collections.NET\n```\n\n## Collection extensions\nExtension methods for common collection interfaces like `IEnumerable\u003cT\u003e`, `ICollection\u003cT\u003e` and `IList\u003cT\u003e`.\n\n|Method name|Interface|Description|\n|-----------|---------|-----------|\n|`AddRange`|`ICollection\u003cT\u003e`|Adds one or more items to a collection in a single operation. Inspired by the `List\u003cT\u003e.AddRange` method.|\n|`AllOrNone`|`IEnumerable\u003cT\u003e`|Determines whether all or none of the elements in a sequence match a predicate.|\n|`Chunk`|`IEnumerable\u003cT\u003e`|Splits a collection into chunks of a specified size.|\n|`Fill`|`IList\u003cT\u003e`|Sets all elements in a collection to a specific value.|\n|`ForEach`|`IEnumerable\u003cT\u003e`|Iterates over each element in a collection and calls the specified delegate for each item. Inspired by the `List\u003cT\u003e.ForEach` method.|\n|`IndexOf`|`IList\u003cT\u003e`|Finds the index of the first matching element in a collection based on the specified predicate.|\n|`IndexOfAll`|`IList\u003cT\u003e`|Finds all indices of the matching elements in a collection based on the specified predicate.|\n|`InsertRange`|`IList\u003cT\u003e`|Inserts one or more items into a collection at the given location in a single operation.|\n|`IsEmpty`|`IEnumerable\u003cT\u003e`|Indicates whether a collection is empty. A better way of doing `if !collection.Any()`|\n|`IsNotNullOrEmpty`|`IEnumerable\u003cT\u003e`|Determines whether a sequence is not `null` and has at least one element.|\n|`IsNullOrEmpty`|`IEnumerable\u003cT\u003e`|Indicates whether a collection is `null` or empty.|\n|`LastIndexOf`|`IList\u003cT\u003e`|Finds the index of the last matching element in a collection based on the specified predicate.|\n|`None`|`IEnumerable\u003cT\u003e`|Determines whether none of the elements in a collection satisfies the specified predicate. Opposite of the LINQ `All` extension method.|\n|`Partition`|`IEnumerable\u003cT\u003e`|Checks each element in a collection against a predicate and returns the elements that match and the elements that do not.|\n|`Random`|`IList\u003cT\u003e`|Creates a collection of the specified size with random values picked from a specified collection.|\n|`Range`|`ICollection\u003cT\u003e`|Returns an iterator for the elements in the collection from the specified start index to the end index.|\n|`RemoveAll`|`IList\u003cT\u003e`|Removes all elements from a collection that satisfies the specified predicate.|\n|`RemoveFirst`|`IList\u003cT\u003e`|Removes the first element from a collection that satisfies the specified predicate.|\n|`RemoveLast`|`IList\u003cT\u003e`|Removes the last elements from a collection that satisfies the specified predicate.|\n|`Repeat`|`IEnumerable\u003cT\u003e`|Creates a collection that contains the specified collection repeated a specified number of times.|\n|`Shuffle`|`IEnumerable\u003cT\u003e`|Returns a shuffled collection from a given collection.|\n|`ShuffleInplace`|`IList\u003cT\u003e`|Shuffles the elements of a collection.|\n|`SlidingChunk`|`IList\u003cT\u003e`|Returns overlapping chunks of elements of the specified size from a collection.|\n|`ToArray`|`IEnumerable\u003cT\u003e`|Creates an array from a collection. Overloads available to select the elements from the collection to be included in the array based on a predicate, and to convert the elements to a different type.|\n|`ToList`|`IEnumerable\u003cT\u003e`|Creates a `List\u003cT\u003e` from a collection. Overloads available to select the elements from the collection to be included in the array based on a predicate, and to convert the elements to a different type.|\n|`Union`|`IEnumerable\u003cT\u003e`|Produces a set union of two sequences.|\n|`WhereNot`|`IEnumerable\u003cT\u003e`|Filters a collection on the values that do not match the specified predicate. Inverse of the LINQ `Where` method.|\n\n## Dictionary extensions\nExtension methods on the `IDictionary\u003cT, U\u003e` interface.\n\n|Method name|Description|\n|-----------|-----------|\n|`AddOrUpdate`|Adds a new entry for a specified key if it doesn't already exist, otherwise updates the existing entry.|\n|`GetValueOrDefault`|Gets a value for a specified key or a default value if the key does not exist.|\n|`GetValueOrAdd`|Gets a value for a specified key or adds an entry if the key does not exist.|\n\n## Byte array extensions\nExtension methods that provide commonly-used operations on `byte` arrays.\n\n\u003e Since .NET arrays implement `IList\u003cT\u003e`, most of the extension methods operate on `IList\u003cbyte\u003e` rather than just `byte[]`. The documentation will continue to refer to them as byte arrays.\n\n|Method name|Description|\n|-----------|-----------|\n|`IsEqualTo`|Checks whether two byte collections contain the same data.|\n|`IsNullOrZeroed`|Indicates whether a byte collection is `null`, empty or contains only zeroes.|\n|`IsZeroed`|Indicates whether a byte collection is empty or contains only zeroes.|\n|`ToString`|Joins all values in a byte collection using a specified delimiter.|\n\n### Byte sequence operations\nThe byte array extensions also provide a number of methods to deal with sequences of bytes:\n\n|Method name|Description|\n|-----------|-----------|\n|`GetBytesUptoSequence`|Gets all the bytes in a byte array up to the specified byte sequence.|\n|`IndexOfSequence`|Gets the index of the first occurence of the specified byte sequence in a byte array.|\n|`IndexOfSequences`|Gets all indices of the occurences of the specified byte sequence in a byte array.|\n|`SplitBySequence`|Splits a byte array by the specified byte sequence.|\n\n## `EnumIterator` class\nThe `EnumIterator` class provides two static methods to create an iterator for the values of an `enum`.\n\n```cs\n// First overload - takes a generic type parameter for the enum type\nforeach (DayOfWeek day in EnumIterator.For\u003cDayOfWeek\u003e())\n{\n    Console.WriteLine(day);\n}\n\n// Second overload - non-generic method that accepts Type parameter.\nList\u003cDayOfWeek\u003e days = EnumIterator.For(typeof(DayOfWeek)).ToList();\ndays.ForEach(Console.WriteLine);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeevanjames%2Fcollections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeevanjames%2Fcollections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeevanjames%2Fcollections/lists"}