[Mono-devel-list] Generics qstn - was: The type mscorlib has two conflicting definitons

James Fitzsimons james.fitzsimons at gmail.com
Sun Jan 16 05:45:25 EST 2005


Hi all,

I've figured out what the problem was, but I'm not sure my code is
actually wrong.

I had the following definitions (implementation not included):

public interface IKDTreeDomain

public class StereoFeature : IKDTreeDomain

public class KDTree
{
        public List<IKDTreeDomain> NearestNeighbourRange (IKDTreeDomain
                        target, double range, out double resDist)
}

and was calling the NearestNeighbourRange method like so:

List<StereoFeature> closeKeys = kd.NearestNeighbourRange(refFeature, 20,
                                                        out dist);

This cause the error:
BETA SOFTWARE: Mono C# Compiler 1.1.2.0 for Generics
> ./StereoMatcher.cs(89) error CS0029: Cannot convert implicitly from
> `System.Collections.Generic.List`1' to
> `System.Collections.Generic.List`1'
> ./StereoMatcher.cs(89) The type mscorlib, Version=2.0.3600.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 has two conflicting
> definitons, one comes from mscorlib, Version=2.0.3600.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 and the other from
> mscorlib, Version=2.0.3600.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089error
> Compilation failed: 1 error(s), 0 warnings
> make: *** [slam.exe] Error 1

when I changed the way I was calling kd.NearestNeighbourRange to this:

List<IKDTreeDomain> closeKeys = kd.NearestNeighbourRange(refFeature, 20,
                                                        out dist);
the compiler was happy.

Is my code wrong? I thought that as my StereoFeature class implemented
the IKDTree interface it could be used in place of IKDTree. If so is
this a bug in the compiler?

Cheers,
James Fitzsimons
-- 
It's 5.50 a.m.... Do you know where your stack pointer is ?




More information about the Mono-devel-list mailing list