ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Bissell" <ch...@enhypniomancy.com>
Subject Latest nightly build and existing List-based Generics calls result in ambiguous method
Date Thu, 18 May 2006 07:47:01 GMT
Hey folks,

 

One of the cool things about IBatis was that the below code actually worked
when running the 1.1 codebase in the 2.0 Framework:

 

       List<DoNotMail> items = new List<DoNotMail>();

       mapper.QueryForList("GetDoNotMail_Check", email, items);

 

The thing is, the above code pattern, while perfectly legal, will result in
a compile error in the current 2005 sourcetree:

 

Error     317       The call is ambiguous between the following methods or
properties: 'IBatisNet.DataMapper.SqlMapper.QueryForList(string, object,
System.Collections.IList)' and
'IBatisNet.DataMapper.SqlMapper.QueryForList<MySpace.Domain.Media.Song>(stri
ng, object, System.Collections.Generic.IList<MySpace.Domain.Media.Song>)'

 

The reason for this is that the 1st method technically accepts an IList, and
a generic List still implements IList.  So IList and IList<T> are not
mutually exclusive.  

 

While the above code would compile fine if the second line were re-written
as:

 

       sql.QueryForList<Song>("GetBandSongList", bandID, songList);

                     

it makes me wonder if this kind of pattern (differentiating between generic
lists and lists - when they both implement IList) will result in more of
these types of logical issues?

 

Thoughts?

 

Chris

 

 


Mime
View raw message