Are .NET resource file files interned?

When I use a .resx file to store fixed string values ​​(to bind to controls on an .aspx page), are these strings interned?

I assume that the compiler reads in strings from an XML file and replaces them as literals in code, and therefore they become interned.

Is it correct?

+2
source share
1 answer

@ Marc is a good point. I tried this and the answer is no, they are not interned, at least for the GetGlobalResourceObject () method, so I assume the same for local resources.

So now I wonder why. Resources are constants, and they are often used, so I would think that interning makes sense.

Obviously, they are not literals, since they must be loaded from the XML resource file, but that doesn’t matter, does it?

0
source

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


All Articles