How to make 2 incompatible types, but with the same members, interchangeable?

前端 未结 4 1891
鱼传尺愫
鱼传尺愫 2020-12-29 16:35

Yesterday 2 of the guys on our team came to me with an uncommon problem. We are using a third-party component in one of our winforms applications. All the code has already b

4条回答
  •  醉话见心
    2020-12-29 17:12

    Add an interface. You could add one wrapper (that implements the interface) for each of the 3rd parties.

    Anyway, if you have the code of those 3rd parties, you could skip the wrapper thing and directly implement the interface. I'm quite sure you don't have the source, though.

提交回复
热议问题