Open sandboxFocus

Class ImmutabilityConfigurationExtensions

Provides extension methods for configuring the immutability of types via fabrics.

Inheritance
ImmutabilityConfigurationExtensions
Namespace: Metalama.Patterns.Immutability.Configuration
Assembly: Metalama.Patterns.Immutability.dll
Syntax
[CompileTime]
public static class ImmutabilityConfigurationExtensions
Remarks

These methods allow you to assign an ImmutabilityKind to types for which you cannot add the ImmutableAttribute aspect directly, such as types from external libraries.

You can pass either a fixed ImmutabilityKind if the type always has the same immutability, or an IImmutabilityClassifier to determine the immutability dynamically, which is useful for generic types whose immutability depends on their type arguments.

Methods

Name Description
ConfigureImmutability(IQuery<INamedType>, IImmutabilityClassifier)

Configures the immutability of a type by supplying an IImmutabilityClassifier. The classifier will be used to determine the immutability of the type dynamically, which is useful for generic types whose immutability depends on their type arguments.

ConfigureImmutability(IQuery<INamedType>, ImmutabilityKind)

Configures the immutability of a type by supplying an ImmutabilityKind.

ConfigureImmutability(IQuery<INamespace>, IImmutabilityClassifier)

Configures the immutability of a namespace by supplying an IImmutabilityClassifier. The classifier will be used to determine the immutability of each type in the namespace dynamically.

ConfigureImmutability(IQuery<INamespace>, ImmutabilityKind)

Configures the immutability of a namespace by supplying an ImmutabilityKind. All types in the namespace will be assigned this immutability kind.

See Also