tag:blogger.com,1999:blog-385473814989421290.post576637242109682175..comments2017-12-12T12:23:48.029+00:00Comments on Morts Like Us: WTF: Overloading and GenericsAnonymoushttp://www.blogger.com/profile/06590048937018839085noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-385473814989421290.post-79017586503098257332008-01-01T18:54:00.000+00:002008-01-01T18:54:00.000+00:00It's working as expected, but your explanation isn...It's working as expected, but your explanation isn't what the compiler is doing.<BR/><BR/>Your call is Foo(x) where x is of compile-time type DString.<BR/><BR/>The choices are:<BR/><BR/>void Foo(params IString[] bars)<BR/>void Foo<T>(T bar)<BR/><BR/>Type inference determines that the second call is applicable, with T=DString. So in other words, you then have a situation similar to:<BR/><BR/>void Foo (params IString[] bars)<BR/>void Foo (DString bar)<BR/><BR/>and you're calling it with a single DString parameter.<BR/><BR/>Now which overload do you expect it to use? :)<BR/><BR/>Hope that helps,<BR/>JonJon Skeethttps://www.blogger.com/profile/09730219126872960482noreply@blogger.com