ExpressionToCodeLib 1.4.0

Generates valid, readable C# from an Expression Tree, and can annotate that code with runtime values.  This can be useful for code generation and for unit testing: ExpressionToCode detects NUnit, xUnit.NET and MSTest and uses their assertions if available, and a normal Exception otherwise (so it runs fine outside those specific unit testing frameworks too).

ExpressionToCode was inspired by Power Asssert.NET. It differs from PowerAssert.NET by supporting a much larger portion of the lambda syntax and to respect C#'s normal operator precedence, in addition to general polish.

There is a newer version of this package available.
See the version list below for details.
Install-Package ExpressionToCodeLib -Version 1.4.0
dotnet add package ExpressionToCodeLib --version 1.4.0
<PackageReference Include="ExpressionToCodeLib" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExpressionToCodeLib --version 1.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Better layout in the face of non-fixed-width rendering: Although fixed-width rendering is the only way to be sure the subexpression annotations line up with the actual expression, ExpressionToCode now uses a mixture of normal spaces and en spaces in the subexpression annotation so that the alignment is roughly OK in many cases even with variable width fonts.
Supports inferring char constants in expressions such as "someVar == 'b'" (C# compiles these as integer constants, heuristics are used to identify those integers that were likely chars in the original code).

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
3.2.0 1,241 2/10/2019
3.1.0 4,018 7/10/2018
3.1.0-alpha 172 7/10/2018
3.0.0 348 6/27/2018
3.0.0-beta1 174 6/26/2018
3.0.0-alpha4 165 6/15/2018
3.0.0-alpha3 174 6/15/2018
3.0.0-alpha2 164 6/12/2018
3.0.0-alpha1 170 6/3/2018
2.7.0 5,142 2/19/2018
2.6.0 237 2/16/2018
2.6.0-signed 248 2/16/2018
2.5.1 4,991 10/30/2017
2.5.0 551 9/20/2017
2.4.1 256 8/23/2017
2.4.0 472 6/1/2017
2.3.0 240 6/1/2017
2.2.0 311 5/10/2017
2.1.0 271 5/5/2017
2.0.0 288 4/26/2017
2.0.0-beta7 237 4/10/2017
2.0.0-beta6 224 3/30/2017
2.0.0-beta5 245 3/30/2017
2.0.0-beta4 229 3/26/2017
2.0.0-beta3 214 3/26/2017
2.0.0-beta2 364 1/25/2017
2.0.0-alpha9 253 1/25/2017
2.0.0-alpha6 766 7/29/2016
2.0.0-alpha4 362 2/24/2016
2.0.0-alpha 286 2/7/2016
1.5.4 7,836 7/7/2015
1.5.3 1,977 6/15/2015
1.5.2 826 3/22/2015
1.5.1 491 3/10/2015
1.5.0 564 3/7/2015
1.4.8 988 1/21/2015
1.4.7 431 1/11/2015
1.4.6 2,002 8/30/2014
1.4.5 2,215 5/29/2014
1.4.4 3,824 4/9/2013
1.4.3 512 4/5/2013
1.4.2 481 3/29/2013
1.4.1 468 3/26/2013
1.4.0 484 3/12/2013
1.3.0 518 3/11/2013
1.2.0 493 3/8/2013
1.1.0.1 489 3/7/2013
1.1.0 479 3/7/2013
Show less