[Mono-list] CS0278 "ambiguous implementation of `enumerable' pattern"

Chris Seaton chris at chrisseaton.com
Thu Jan 18 14:24:22 EST 2007


Is that the long term solution?! I'm using a basic statement on a  
class provided by a library and I'm getting warnings. Can't it  
default to using one of the implementations? What does Microsoft's  
compiler do?

Apart from anything else it makes it very hard to see actual errors  
and warnings in the compiler output.

Chris

On 18 Jan 2007, at 18:14, Felipe Almeida Lessa wrote:

> On 1/18/07, Chris Seaton <chris at chrisseaton.com> wrote:
>> Katahdin.Debugger/RuntimeThread.cs(65,21): warning CS0278:
>> `System.Collections.Generic.IList<string>' contains
>> ambiguous implementation of `enumerable' pattern. Method
>> `System.Collections.IEnumerable.GetEnumerator()' is
>> ambiguous with method
>> `System.Collections.Generic.IEnumerable<string>.GetEnumerator()'
>
> The problem is that the compiler don't know if it uses IEnumerable ou
> IEnumerable<T>, both which are implemented by IList<T>. You can solve
> this by writing an explicit cast:
>
>                    foreach (string file in (IEnumerator<string>)files)
>                        runtime.Import(file);
>
> -- 
> Felipe.



More information about the Mono-list mailing list