Given:
interface ICompass{}
interface INorth : ICompass{ ... stuff ...}
interface ISouth : ICompass{ ... stuff ... }
interface IEast : ICompass { .. stuff ...}
interface IWest : ICompass { .. stuff ... }
interface Box{ ... stuff ... };
interface Carton { ... stuff ...};
interface Bag { ... stuff ...}
and a whole series of classes that implement them, such as
class Thing : INorth, ICarton { ... stuff ... }
class AnotherThing : ISouth, IBag { ... stuff ... }
how can I find out whether two instances have the same Compass interface
without resorting to
if (left is INorth)
return right is INorth
else if (left is ISouth)
return right is ISouth
else ...
TIA,
Andrew
interface ICompass{}
interface INorth : ICompass{ ... stuff ...}
interface ISouth : ICompass{ ... stuff ... }
interface IEast : ICompass { .. stuff ...}
interface IWest : ICompass { .. stuff ... }
interface Box{ ... stuff ... };
interface Carton { ... stuff ...};
interface Bag { ... stuff ...}
and a whole series of classes that implement them, such as
class Thing : INorth, ICarton { ... stuff ... }
class AnotherThing : ISouth, IBag { ... stuff ... }
how can I find out whether two instances have the same Compass interface
without resorting to
if (left is INorth)
return right is INorth
else if (left is ISouth)
return right is ISouth
else ...
TIA,
Andrew
Comment