https://github.com/badeend/valuecollections
Low overhead immutable collection types with structural equality.
https://github.com/badeend/valuecollections
csharp domain-driven-design immutable json value-object
Last synced: 5 days ago
JSON representation
Low overhead immutable collection types with structural equality.
- Host: GitHub
- URL: https://github.com/badeend/valuecollections
- Owner: badeend
- License: mit
- Created: 2024-03-14T16:00:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-05T14:35:28.000Z (about 1 year ago)
- Last Synced: 2025-12-13T09:54:04.237Z (2 months ago)
- Topics: csharp, domain-driven-design, immutable, json, value-object
- Language: C#
- Homepage: https://badeend.github.io/ValueCollections/
- Size: 1.03 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Zero-overhead immutable collection types with structural equality.
---
Zero-overhead collection types with:
- **Immutability**: Once constructed, the collections cannot be changed anymore. Efficient construction can be done using so called Builders.
- **Value equality**: Two collections are considered "equal" when they have the same type and the same content.
The combination of these two properties neatly complement C# `record` types and streamline the implementation of Value Objects (DDD).
In general, the performance and memory usage is equivalent to the regular `System.Collections.Generic` types. Converting a Builder to an immutable instance is an `O(1)` operation.
More information at: https://badeend.github.io/ValueCollections/
---
### Shameless self-promotion
May I interest you in one of my other packages?
- **[Badeend.ValueCollections](https://badeend.github.io/ValueCollections/)**: _Low overhead immutable collection types with structural equality._
- **[Badeend.EnumClass](https://badeend.github.io/EnumClass/)**: _Discriminated unions for C# with exhaustiveness checking._
- **[Badeend.Result](https://badeend.github.io/Result/)**: _For failures that are not exceptional: `Result` for C#._
- **[Badeend.Any](https://badeend.github.io/Any/)**: _Holds any value of any type, without boxing small structs (up to 8 bytes)._
- **[Badeend.Nothing](https://github.com/badeend/Nothing)**: _If you want to use `void` as a type parameter, but C# won't let you._