2 ms·
`readonly class` exists in C# today and is called (just) `record`. `in` already implies the reference cannot be mutated, which is the bit that actually passes
by WorldMaker 11mo ago
`readonly class` exists in C# today and is called (just) `record`.
`in` already implies the reference cannot be mutated, which is the bit that actually passes to the function. (Also the only reason you would need `in` and not just a normal function parameter for a class.) If you want to assert the function is given only a `record` there's no type constraint for that today, but you'd mostly only need such a type constraint if you are doing Reflection and Reflection would already tell you there are no public setters on any `record` you pass it.