C#C
C#3y ago
Man

Expressing intent that method parameters are immutable for reference type arguments

If I want to express intent that a reference type argument is passed into a function, but isn't mutated, may I do so with
in
keyword, or should I use
ref readonly
, or is this entirely innapropriate (has performance downsides)?

I do know that I also still need to do the hard work of making sure that the class's members are
readonly
too, if I want "true immutability".
Was this page helpful?