Re: cannot implement both 'I<X>' and 'I<Y>' because they may unify for some type parameter substitutions....
Mike Andrews <[email protected]> Wed, 26 Aug 2009 09:39:09 -0500
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
The explanation given for this particular error is that they may unify if X and Y are the same type which then means that they would be the same interface definition and the compiler wouldn't have a way to tell which property or method to call on which interface. As a rule, I<X> and I<Y> are considered different types by the compiler, but if X and Y are both int then I<int> is the same type as I<int>. I'm not really sure how this can be accomplished. If you don't mind my asking, what problem are you trying to solve using this method? Perhaps I can suggest another course of action. On Wed, Aug 26, 2009 at 9:18 AM, Mark Nicholls <[email protected]>wrote: > I have a duplicate interface problem.... > > I actually (and actively) want to potentially implement the same interface > twice... > > I don't care which interface implementation is used (in Dbc terms it makes > not difference to me) , dotnet can 'choose' either.. > > Is there any way of implementing this? > > (I've tried F# thinking it may be more 'logical'...but it too failed). > > example code... > > interface I<X> > { > } > > interface A<X, Y> : I<X>, I<Y> > { > } > > =================================== > View archives and manage your subscription(s) at > http://peach.ease.lsoft.com/archives > =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives