> > static T GetFirstElement<T>(this System.Collections.Generic.IList<T> list) > > string s = foo.GetFirstElement(); // this should be enough > > If I'm not missing something subtle here: > > If the method is defined as GetFirstElement<T>, then you must supply T when > calling it. This has no relation to extension methods, right?
You only have to supply T when it cannot be deduced from the method's arguments. In this case, it can, as you specify it via the list parameter. The question is why this doesn't work when the method is invoked as an extension method. But it does. Fabian =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com