4 ms·
No, strings are passed by reference, it's just that the string type is immutable. Passing a string to a function doesn't create a copy, but there's also no way
by fluoridation 3y ago
No, strings are passed by reference, it's just that the string type is immutable. Passing a string to a function doesn't create a copy, but there's also no way for the callee to modify the object that the caller points to.
It is true that C# has value types that are by default passed by copy, though.
- raincole 3y agoI mistyped struct as strict.