How to use method hiding (new) with generic constrained class

后端 未结 2 2018

I have a container class that has a generic parameter which is constrained to some base class. The type supplied to the generic is a sub of the base class constraint. The sub cl

2条回答
  •  灰色年华
    2021-01-21 20:43

    Add another layer - inherit your generic not from your third party class but from a new class which in turn inherits from the third party. In this new class you can define the method in question as new virtual. If all your code never references the third part class directly, it should work

提交回复
热议问题