views:

67

answers:

0

I have a predicate, that was made from lambda expression after all extension methods were served. For example:

(new List<string>).Where(i => i.Contains("some")).Where(i => i.Contains("second_some"));

"List<>" is only example, there could be my custom data context or object collection. So, I have an "Expression<...>", and it's base type "Expression".

The question is, is there are any code, which could walk the tree of expression, and replace parameter type (in our sample it is "string") with another one specified?

I have already found how to replace parameter type, but it has a conflict when the method somewhere from "Where" extension method has a signature with old parameter type.

Maybe someone has met solution? Thanks.