![]() |
VOOZH | about |
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" />Directory.Packages.props
<PackageReference Include="ExpressionTreeTestObjects" />Project file
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.23Install as a Cake Addin
#tool nuget:?package=ExpressionTreeTestObjects&version=1.0.23Install as a Cake Tool
Expression trees (and related objects) can be generated in three ways:
Expression<T> variable, parameter or property; the C# compiler generates an expression tree corresponding to the code of the lambda expressionExpression<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 checkUnaryThe static constructor automatically loads types in assemblies that start with ExpressionTreeTestObjects -- ExpressionTreeTestObjects.CSharp.dll, and ExpressionTreeTestObjects.VB.dll.
Call the static LoadType method 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 the objectName.
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 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net452 net452 is compatible. net46 net46 was computed. net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
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 | 814 | 12/23/2021 |
| 1.0.22 | 527 | 12/14/2021 |
| 1.0.21 | 1,008 | 6/6/2021 |
| 1.0.20 | 611 | 5/31/2021 |
| 1.0.19 | 700 | 1/16/2021 |
| 1.0.18 | 920 | 12/6/2020 |
| 1.0.17 | 748 | 12/5/2020 |
| 1.0.14 | 706 | 10/8/2020 |
| 1.0.13 | 721 | 9/23/2020 |
| 1.0.12 | 727 | 9/16/2020 |
| 1.0.11 | 693 | 9/14/2020 |
| 1.0.10 | 745 | 8/31/2020 |
| 1.0.9 | 701 | 8/24/2020 |
| 1.0.8 | 683 | 8/18/2020 |
| 1.0.7 | 676 | 8/5/2020 |
| 1.0.6 | 749 | 7/19/2020 |
| 1.0.5 | 5,184 | 7/19/2020 |
| 1.0.4 | 703 | 7/16/2020 |
| 1.0.3 | 830 | 6/27/2020 |
| 1.0.2 | 933 | 3/29/2020 |