C# Multiple generic constraints

后端 未结 7 1025
野性不改
野性不改 2020-12-17 09:17

I was wondering if it is possible to add multiple generic constraints?

I have an Add method that takes an Object (Either Email, Phone or Address), so i was thinking

7条回答
  •  清酒与你
    2020-12-17 10:16

    You don't get any real benefits from generics in this case. I would just create different Add methods for each parameter Type.

提交回复
热议问题