I have a class that performs some I / O on the entire disk volume. By sensitive I mean, if the operation goes wrong, it could potentially damage the target volume.
During some testing after the release, I found that the process can be ruined by using reflection to manipulate private fields. The class is not sealeddesigned, so library users can create derivatives.
Is there a way to protect private members to prevent change through reflection (from derived or consumer code)?
UPDATE: I found a comment from Hans Passant on an old mention issue[ReflectionPermission] . Look at it now.
source
share