When I use a .resx file to store fixed string values (to be bound开发者_StackOverflow to controls on an .aspx page), are these strings interned?
I presume the compiler reads in the strings from the XML file and replaces them as literals in the code, and therefore they become interned.
Is this correct?
@Marc- good point. I tried it and the answer is, 'no', they're not interned, at least for the GetGlobalResourceObject() method, so I assume the same for local resources.
So, now I wonder why. Resources are meant to be constants and they are frequently used, so I would have thought interning makes sense.
Obviously, they're not literals, as they must be loaded from the XML resources file, but that shouldn't matter, should it?
精彩评论