Open sandboxFocus

Enum ImmutabilityKind

Specifies the kind of immutability of a type.

Namespace: Metalama.Patterns.Immutability
Assembly: Metalama.Patterns.Immutability.dll
Syntax
[RunTimeOrCompileTime]
public enum ImmutabilityKind
Remarks

This enumeration is used with the ImmutableAttribute aspect and the ConfigureImmutability(IQuery<INamedType>, ImmutabilityKind) fabric extension method to specify or query the immutability characteristics of types.

Deep immutability provides stronger guarantees than shallow immutability and is required by certain code analyses, such as those performed by the Metalama.Patterns.Observability package.

Fields

Name Description
Deep

The type is deeply immutable: all instance fields and automatic properties are of a deeply immutable type, ensuring that all objects reachable by recursively evaluating fields or properties are also immutable.

None

The type is mutable.

Shallow

The type itself is immutable (all instance fields are read-only and no automatic property has a setter), but some of its fields or properties may reference mutable objects.

See Also