By @aaronsaray · 2021-10-21 20:11
Good tip. Generally having to access non-public properties is a sign of poor code, but I see two scenarios when this is useful — when something really shouldn't be public but you just need to test it (without adding accessors either, since the value should really be "hidden"), and when working with third party libraries.
Third party libraries, especially old ones, often poorly account for people's use cases, so you sometimes have to access or set protected properties even in your normal code. I've had this experience with a few SDKs for some services' APIs.