使用反射在所有子类上获取私人字段?
我尝试过,
type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
但这只会返回受保护的字段,该代码在基类中声明,私有字段在派生的类中声明,如果我对此字段进行保护,则将其返回...
I tried
type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
But this will only return protected fields, this code is declared on the base class, the private field is declared in a derived class, if I make this field protected, it gets returned...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论