ExpressionTreeTestObjects 1.0.23
dotnet add package ExpressionTreeTestObjects --version 1.0.23
NuGet\Install-Package ExpressionTreeTestObjects -Version 1.0.23
<PackageReference Include="ExpressionTreeTestObjects" Version="1.0.23" />
<PackageVersion Include="ExpressionTreeTestObjects" Version="1.0.23" />
<PackageReference Include="ExpressionTreeTestObjects" />
paket add ExpressionTreeTestObjects --version 1.0.23
#r "nuget: ExpressionTreeTestObjects, 1.0.23"
#:package ExpressionTreeTestObjects@1.0.23
#addin nuget:?package=ExpressionTreeTestObjects&version=1.0.23
#tool nuget:?package=ExpressionTreeTestObjects&version=1.0.23
Expression trees (and related objects) can be generated in three ways:
- Calling the factory methods at System.Linq.Expressions.Expression
- In C#, assigning a lambda expression to an
Expression<T>variable, parameter or property; the C# compiler generates an expression tree corresponding to the code of the lambda expression - The VB compiler also generates expression trees from VB lambda expressions assigned to
Expression<T>.
As part of the development of ExpressionTreeToString, I needed a comprehensive set of expression trees to test the renderers against. This set of objects is available as a Nuget package.
Each expression object is a field with the TestObject attribute applied to it.
The objects are available by referencing the NuGet package, and calling the static Get method:
// using ExpressionTreeTestObjects;
(string category, string source, string name, object o)[] lst = Objects.Get();
where source is the type where the object is defined -- one of the following:
| Source | Description |
|---|---|
Factory methods |
Factory methods |
CSCompiler |
C# compiler |
VBCompiler |
VB compiler |
and category is one of these values:
BinaryBlocksConditionalsConstantsDebugInfosDefaultsDynamicsGotosIndexerInvocationLabelsLambdaLiteralLoopsMember access (+ closed variables)Member bindingsMethod callNew arrayObject creation and initializationQuotedRuntime variablesSwitch, CatchBlockTry, Catch, FinallyType checkUnary
The static constructor automatically loads types in assemblies that start with ExpressionTreeTestObjects -- ExpressionTreeTestObjects.CSharp.dll, and ExpressionTreeTestObjects.VB.dll.
Call the static
LoadTypemethod on the containing type:Objects.LoadType(typeof(MyCustomType));and it will add the object. The type name becomes the
source, and the field name becomes theobjectName.
The C# and VB compiler test expressions were added as I was working on the corresponding renderers. For the factory methods, I used reflection to build a list of all the methods and overloads at System.Linq.Expressions.Expression and created expressions by calling each one.
The result is pretty comprehensive, with one limitation: I didn't write test expressions for overloads which take an additional MethodInfo, like this one. This is being tracked at #20.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on ExpressionTreeTestObjects:
| Repository | Stars |
|---|---|
|
zspitz/ExpressionTreeVisualizer
Debugging visualizer for expression trees
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.23 | 702 | 12/23/2021 |
| 1.0.22 | 457 | 12/14/2021 |
| 1.0.21 | 933 | 6/6/2021 |
| 1.0.20 | 539 | 5/31/2021 |
| 1.0.19 | 622 | 1/16/2021 |
| 1.0.18 | 818 | 12/6/2020 |
| 1.0.17 | 675 | 12/5/2020 |
| 1.0.14 | 626 | 10/8/2020 |
| 1.0.13 | 652 | 9/23/2020 |
| 1.0.12 | 662 | 9/16/2020 |
| 1.0.11 | 623 | 9/14/2020 |
| 1.0.10 | 679 | 8/31/2020 |
| 1.0.9 | 620 | 8/24/2020 |
| 1.0.8 | 630 | 8/18/2020 |
| 1.0.7 | 610 | 8/5/2020 |
| 1.0.6 | 683 | 7/19/2020 |
| 1.0.5 | 4,907 | 7/19/2020 |
| 1.0.4 | 624 | 7/16/2020 |
| 1.0.3 | 762 | 6/27/2020 |
| 1.0.2 | 862 | 3/29/2020 |
| 1.0.1 | 794 | 12/18/2019 |
| 1.0.0 | 721 | 12/18/2019 |