> I discovered this with a more complicated example and used IList as a
> simple example....I'm either completely wrong, or the example is too
> simple.

Maybe you hit the issue where generic arguments used only for a
method's return type are not inferred from usage. Like this:

public static T Get<T>() { ... }
int i = Get<int>(); // needs T to be specified, although "int" could be inferred

If one generic argument cannot be inferred, all need to be specified:

public static T1 Get<T1, T2>(T2 arg) { ... }
int i = Get<int, string> ("xy"); // needs int _and_ string to be specified

With an extension method:

public static T1 Get<T1, T2>(this IList<T2> list) { ... }
IList<string> list;
int i = list.Get<int, string>(); // needs int _and_ string to be specified

Fabian

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to