Answer the question
In order to leave comments, you need to log in
Where is the data written that such and such a variable is a constant?
For example, we have code:
const int i = 5;
const string g = "6";
Answer the question
In order to leave comments, you need to log in
You already asked: Where in an instance of a primitive reference type, such as string, is the information that this instance is a constant?
when the code is already compiled, it is not stored anywhere. we just have the values.
during compilation - it is stored like this
https : //github.com/dotnet/roslyn/blob/7a836c8e5a06... /7a836c8e5a06...
But again, this is only necessary for the compiler to know what to do with these values. As a result, the values of the constants will be substituted for all places of use (which you can easily verify by decompiling the code)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question