コード例 #1
0
        /// <summary>
        /// If (a) <paramref name="expression"/> is of type `bool` and (b) it is `false`, attempts to return a string representation of *why* it is `false`.
        /// Otherwise, behaves the same as <see cref="GetFullString"/>.
        /// <paramref name="expression"/> must be compilable without arguments.
        /// </summary>
        public static (string ExpressionString, IReadOnlyCollection <(string Name, object Value)> DebugValues) GetDiagnosticString(Expression expression)
        {
            var vistor = new DebugValueExpressionVisitor();

            vistor.VisitDiagnosticRoot(expression);
            return(vistor.ToString(), vistor.DebugValues);
        }