> I seem to be haveing problems with extension methods.... > > sometimes the compiler complains... > > "does not contain a definition for 'BLA' and no extension method 'BLA' > accepting a first argument of type 'WHATEVER...' could be found (are you > missing a using directive or an assembly reference?)" > > (I've changed the class names to make the error readable) > > now one would think that that meant there that there was no solution to > the 'pattern' match/inference....but I can actually explicitly define the > types e.g. > > x.BLA<int,object>(foo,bar); > > and the compiler will happily accept it...and run it. > > is there a bug in the type inference mechanism? > > if there were more than 1 solution to the inference I would expect the > compiler to ask me to specify them...as it does sometimes....any ideas?
if 'foo' and/or 'bar' are lambda expressions, you get this error, as lambda expressions in code aren't instances, they need a type to get compiled, and not specifying int/object in BLA forces the compiler to check the parameter (foo/bar) to learn the type for int/object, however THOSE are needed for foo/bar ;) FB =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com