I am writing an AOP against an old legacy class that does not have the benefit of a built in IoC container. I am employing the power of dynamic types, using the DynamicObject derived class. When I use the
mi = obj.GetType().GetMethod(methNm, parmType);
call, if the parameters types (represented by parmType, above) are not exactly the types that the method was declared with, then the above GetMthod(..) will not find the method.
My question to you is: Do you know of a way, potentially using Roslyn's semantic model, to employ the same set of rules that are used by the compiler to match the method in GetMethod(..) to the "best choice" of a method?
What I have tried:
I am reading through the RuntimeBinder hoping to find a clue...