You will need to modify your CustomMethod to take Expression<Func<TSource, object>>and, possibly, a subclass ExpressionVisitor, overriding VisitMember:
public void CustomMethod(Expression<Func<TSource, object>> method)
{
PropertyFinder lister = new PropertyFinder();
properties = lister.Parse((Expression) expr);
}
List<string> properties;
public class PropertyFinder : ExpressionVisitor
{
public List<string> Parse(Expression expression)
{
properties.Clear();
Visit(expression);
return properties;
}
List<string> properties = new List<string>();
protected override Expression VisitMember(MemberExpression m)
{
... code here ...
return base.VisitMember(m);
}
}
This should help you get started in the right direction. Let me know if you need help figuring out the "... code here ..." part.
Useful links: