What if you nested the `MemberExpressionVisitor` class inside another class? Since I like extension methods, create a static class that contains an extension method on `Expression<Func<T,TRes>>` that creates the visitor, runs it and returns the result:

    static class LambdaExt {
        public static List<string> GetAccessedMemberNames<T, TRes>(this Expression<Func<T, TRes>> startExpr) {
            var v = new MemberExpressionVisitor<T, TRes>();
            v.Visit(startExpr);
    
            return v.GetAccessedMembers();
        }

        // put MemberExpressionVisitor definition here
    }

Now you can use it like:

    Console.WriteLine(String.Join(", ", exp.GetAccessedMemberNames()));