© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
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
in
keyword, or should I use
ref readonly
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
readonly
too, if I want "true immutability".
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

String : Immutable reference type
C#CC# / help
3y ago
✅ reference type values are strange..
C#CC# / help
4y ago
✅ Why string are immutable?
C#CC# / help
4y ago
method reference/callback
C#CC# / help
3y ago