Mr. Dink
✅ Is there something like MemberwiseCopy rather than MemberwiseClone?
I have a library I'm trying to keep AoT compatible. I have a class that users will extend for extra fields/properties for state that gets serialized. Because there will be hundreds of theses objects created and discarded per second, they're pooled. To make things more complicated, the system often needs to shallow copy them.
MemberwiseClone()
seems to work great for this since you can define it in the base class and all inherited types can use it. This would be the answer and I'd be done, but it allocates a clone rather than copies to a provided pooled object. Is there a similar way to do this while remaining AoT compatible?
My other option is to rewrite the system to not be extended and instead configured with some complex struct setup for the user's state, but I'd rather not have to explore that route if I need to.14 replies
✅ Access a runtime Dictionary easier
My company is switching from
ConfigurationManager
with transforms over to a 3rd party secrets manager. The secrets manager returns a Dictionary<string, object>
on start up. I'm needing to go through and replace all ConfigurationManager
calls throughout the project and I was wondering if there's an easier way to access these values rather than magic strings. My first thought is a static class where I define all the property shortcuts and keys. Then verify all keys are present on project load when we get the secrets. Am I barking up the wrong tree and there's an established way?42 replies