NDepend.API Documentation
IsImmutable Property (IType)
NDepend.CodeModel Namespace > IType Interface : IsImmutable Property
Gets a value indicating whether this type is immutable. A type is considered as immutable if its instance fields cannot be modified once an instance has been built by a constructor.
Syntax
bool IsImmutable {get;}
Remarks
It is still possible to break immutability by using the ref C# keyword (ByRef in VB.NET) to allow a tier method to modify the state of an instance field.
As .NET framework designers considered that the immutability of the class System.String can be broken using advanced means such as reflection or unsafe code, you should consider that using the C# keyword ref or reflection or unsafe code are advanced means to break immutability of your own types.
Immutable types are especially useful when you have to deal with multi-threading application. Indeed, accesses to instances of immutable types don’t need to be synchronized because such objects can’t be modified; hence all accesses are read-only accesses.
To enforce your classes and structures immutability, see the attribute class NDepend.Attributes.ImmutableAttribute.
Requirements

Target Platforms: Windows 11, 10, 8, 7 and Linux, MacOS with net8.0, net7.0 or net6.0 installed

See Also

Reference

IType Interface
IType Members