Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

ReadableExpressions

NuGet

ReadableExpressions is set of Debugger Visualizers and a NuGet-packaged extension method for readable, source-code versions of Expression Trees.

Debugger Visualizers

An installer for the Expression Debugger Visualizers can be downloaded from the Visual Studio Gallery.

The visualizer has both Light and Dark themes:

[Visualizer themes]

...and output can be customised using various options:

[Visualizer options]

NuGet Package

The extension method is available in a NuGet package targeting .NETStandard 1.0+ and .NET 3.5+:

PM> Install-Package AgileObjects.ReadableExpressions

...and is used like so:

using AgileObjects.ReadableExpressions;

string readable = myExpression.ToReadableString();

...it also works on DynamicLanguageRuntime expressions.

Options

To include namespaces when outputting type names, use:

string readable = myExpression
    .ToReadableString(c => c.UseFullyQualifiedTypeNames);

To use full type names instead of var for local and inline-declared output parameter variables, use:

string readable = myExpression
    .ToReadableString(c => c.UseExplicitTypeNames);

To declare output parameter variables inline with the method where they are first used, use:

string readable = myExpression
    .ToReadableString(c => c.DeclareOutputParametersInline);

To maintain explicit generic arguments on method calls where they are implied, use:

string readable = myExpression
    .ToReadableString(c => c.UseExplicitGenericParameters);

To show implicitly-typed array type names, use:

string readable = myExpression
    .ToReadableString(c => c.ShowImplicitArrayTypes);

To show lambda parameter type names, use:

string readable = myExpression
    .ToReadableString(c => c.ShowLambdaParameterTypes);

To output a source code comment when a lambda is 'quoted', use:

string readable = myExpression
    .ToReadableString(c => c.ShowQuotedLambdaComments);

To define a custom factory for naming anonymous types, use:

string readable = myExpression
    .ToReadableString(c => c.NameAnonymousTypesUsing(
        anonType => GetAnonTypeName(anonType)));

To define a custom factory for translating ConstantExpression values, use:

string readable = myExpression
    .ToReadableString(c => c.TranslateConstantsUsing(
        (constantType, constantValue) => GetConstantValue(constantType, constantValue)));

To specify a custom string for code indenting, use:

string readable = myExpression
    .ToReadableString(c => c.IndentUsing("\t"));
You can’t perform that action at this time.