I have a query, like such:
var query = from sessions in dataSet
where (names.Contains(sessions.Username))
where (sess
Use the class found here http://msdn.microsoft.com/en-us/library/bb882521%28v=vs.90%29.aspx as your base. You can then create your Visitor like this
internal class WhereFinder : ExpressionVisitor
{
private IList<MethodCallExpression> whereExpressions = new List<MethodCallExpression>();
public IList<MethodCallExpression> GetWhere(Expression expression)
{
Visit(expression);
return whereExpressions;
}
protected override Expression VisitMethodCall(MethodCallExpression expression)
{
if (expression.Method.Name == "Where")
whereExpressions.Add(expression);
Visit(expression.Arguments[0]);
return expression;
}
}