Using a constant modifier for strings

I am starting a C # programmer, so bear with me. I moved on to other re entries: immutable strings in C #, but they don't make sense to me. Regarding C # immutable strings, why did Microsoft not just add a constant modifier to the string, as in:

const string myString = "my-string";

Also, if mutable strings are so susceptible to so many hacks that they had to be made immutable, does this not apply to other types of variables?

+4
source share

Source: https://habr.com/ru/post/1622849/


All Articles