protected override Expression VisitMethodCall(MethodCallExpression methodCall) { if (!ChainedMethodCalls.Contains(methodCall)) { var methodCallChain = GetChainedMethodCalls(methodCall).ToArray(); if (methodCallChain.Length > 1) { if (methodCallChain.Length > 2) { ChainedMethodCalls.AddRange(methodCallChain); } else if (methodCallChain[0].ToString().Contains(" ... ")) { // Expression.ToString() replaces multiple lines with ' ... '; // potential fragile, but works unless MS change it: ChainedMethodCalls.AddRange(methodCallChain); } } } return(base.VisitMethodCall(methodCall)); }
private void Visit(MethodCallExpression methodCall) { if (!ChainedMethodCalls.Contains(methodCall)) { var methodCallChain = GetChainedMethodCalls(methodCall).ToArray(); if (methodCallChain.Length > 1) { if (methodCallChain.Length > 2) { ChainedMethodCalls.AddRange(methodCallChain); } else if (methodCallChain[0].ToString().Contains(" ... ")) { // Expression.ToString() replaces multiple lines with ' ... '; // potential fragile, but works unless MS change it: ChainedMethodCalls.AddRange(methodCallChain); } } } Visit(methodCall.Object); Visit(methodCall.Arguments); }