© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Expressing intent that method parameters are immutable for reference type arguments - 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#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
62,470
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
String : Immutable reference type
C
C# / help
3y ago
✅ reference type values are strange..
C
C# / help
4y ago
method reference/callback
C
C# / help
4y ago
✅ Why string are immutable?
C
C# / help
4y ago