readonly
readonly copied to clipboard
Is it possible to have a Read-Only reference to something?
I have a configuration object that should only be modified by internal modules, but occasionally needs to be read via external pieces of the process. I think the answer is no, but is it possible to take a reference to an object and flag it as read-only such that the original object is untouched, but any access through the new reference is treated as read-only (while still pointing to the original object)? I'm pretty sure that there is no good way to do this, but I figured it couldn't hurt to ask...