Possible Duplicate:
Extension method and dynamic object in c#
For example:
var obj = new byte[] { 1, 2, 3 };
dynamic dobj = obj;
dobj.Count(); // fails
Enumerable.Count(dobj); // works
Possible Duplicate:
Extension method and dynamic object in c#
For example:
var obj = new byte[] { 1, 2, 3 };
dynamic dobj = obj;
dobj.Count(); // fails
Enumerable.Count(dobj); // works
It doesn't work because knowing which extension method to call requires knowing what the source code looked like before it was compiled (including knowing which
using
directives were present). At runtime this information is not available. The workaround you are using is a good approach.