For an arbitrary type expression Expression<Func<int>>, how can I get a list of all objects that could, but not necessarily, influence the result.
I am looking for a function like this:
IEnumerable<object> GetFactors(Expression<Func<int>> expression)
{
}
Example 1
Expression<Func<int>> expression = () => a + b;
where aand bare ints, GetFactorsreturns IEnumerable<object>containing aand b.
Example 2
Expression<Func<int>> expression = () => obj1 != obj2 ? a + b : c + d;
GetFactorsreturns IEnumerable<object>containing obj1, obj2, a, b, cand d.
source
share