How can I protect my private funcs against reflection executing?

前端 未结 9 1207
深忆病人
深忆病人 2020-12-05 15:05

After seeing this: Do access modifiers affect reflection also?

I tried using this, but it doesn\'t work: \"enter

9条回答
  •  隐瞒了意图╮
    2020-12-05 15:50

    You can not, the modifiers are only for developers to have proper encapsulation. At the runtime it could be sad that everything is on the same level.

    The reflection mechanics, is used usually by application that need to call some pre-configured methods (older ORM) or display them (IDE). It wold be really hard if this mechanism would not be able to do that.

提交回复
热议问题