Metalama.Patterns.Immutability
v2025.2.5-rcPre-release
.NETFramework4.7.1net6.0.NETStandard2.0
Represents the concept of Immutable Type so that it can be used by other packages like Metalama.Patterns.Observability.
Published
Oct 7, 2025
1y ago
Total Downloads
77.9K
77,928
Install
dotnet add package Metalama.Patterns.Immutability --version 2025.2.5-rc
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
About
The Metalama.Patterns.Immutability implements the concept of immutable type, i.e. types whose value cannot be changed after they have been created. Other packages, such as Metalama.Patterns.Observability, can then rely on this concept to achieve a better understanding of the code.
Key Features
- You can mark types as immutable using the
[Immutable]custom attribute or theConfigreImmutabilityfabric extension warning. - Concept of shallow or deep immutability.
- The
[Immutable]aspect reports warnings if some fields or properties are not mutable.
Main Types
The primary types in this package are:
ImmutabilityKindrepresents the kind of immutability of a type, i.e.None,ShalloworDeep.ImmutableAttributeis an aspect that marks a type as immutable and reports warnings if some fields or properties are mutable.ImmutabilityExtensions.GetImmutabilityis an extension ofINamedTypeto get theImmutabilityKindof a given type.ImmutabilityConfigurationExtensions.ConfigureImmutabilityis a fabric extension method to programmatically set theImmutabilityKindof types.IImmutabilityClassifieris an abstraction whose implementations can be passed toImmutabilityConfigurationExtensions.ConfigureImmutabilityto dynamically return theImmutabilityKindof a kind. It is useful when theImmutabilityKinddepends on type arguments.
Additional Documentation
Related Packages
Metalama.Patterns.Observabilityrelies onMetalama.Patterns.Immutabilityto decide which method calls are supported in property getters.
Changes from Previous Version
No structural changes between v2025.2.4-rc and v2025.2.5-rc.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.