c# - Avoiding repetition in Interface contract classes -


we want use code contracts on our interfaces. have large interface hierarchy, leading awful lot of duplication in contract classes.

we have interface ix (through inheriting other interfaces) has around 50 methods. there several interfaces derive ix. interface iy inherits ix, adding couple of methods. if want add contract class iy, need reference 50+ methods. worse, if later on decide modify ix, have change contract classes interfaces inheriting ix. discourages developers making changes.

is there way of avoiding duplication?

i don't believe possible, no. can't derive 1 interface contract class another, , interface contracts classes can't have base class other system.object. think you're stuck. best way forwards involve kind of code generation tool, or lots of copy-and-pasting.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -