你的位置: 码友网首页 / 资讯源列表 / Bypassing Polymorphism with Reflection in .NET

关于[Bypassing Polymorphism with Reflection in .NET]的摘要:

While implementing support for interface default implementations in NUKE we’ve added the new fluent methods Base and Inherit. In order to let an overridden target inherit from its base declaration (or a re-implemented target with default implementation), we needed to make non-virtual calls using reflection. This wasn’t exactly easy, since even when reflecting on a member through its declaring type, it will follow the principle of polymorphism and call the member virtual. With a bit of Stack Overflow, we ended up implementing the following generic method...

原文地址: https://ithrowexceptions.com/2020/07/13/bypassing-polymorphism-with-reflection-in-dotnet.html

收录时间: 2020-07-15 浏览量: 1163 分类: .NET

| 0 收藏 | 0