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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
usingdirectives were present). At runtime this information is not available. The workaround you are using is a good approach.