String Immutability
noun
say it: “STRING ih-myoo-tuh-BIL-ih-tee” /strɪŋ ɪˌmjuːtəˈbɪlɪti/
The rule that a C# string never changes once it's made; methods that seem to change it return a new string.
What is String Immutability in C#?
String Immutability — The rule that a String's character sequence cannot change after the object is created.
class StatusLabel
{
string status = "open";
string uppercaseStatus = "open".ToUpper();
}
In a sentence
- “Because of string immutability, title.ToUpper() left title unchanged until I stored the result.”
Level: Apprentice · More C# terms at this level
Updated