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" />
paket add ExpressionTreeTestObjects --version 1.0.23
#r "nuget: ExpressionTreeTestObjects, 1.0.23"
// Install ExpressionTreeTestObjects as a Cake Addin #addin nuget:?package=ExpressionTreeTestObjects&version=1.0.23 // Install ExpressionTreeTestObjects as a Cake Tool #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:
Binary
Blocks
Conditionals
Constants
DebugInfos
Defaults
Dynamics
Gotos
Indexer
Invocation
Labels
Lambda
Literal
Loops
Member access (+ closed variables)
Member bindings
Method call
New array
Object creation and initialization
Quoted
Runtime variables
Switch, CatchBlock
Try, Catch, Finally
Type check
Unary
The 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 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. |
.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 | 502 | 12/23/2021 |
1.0.22 | 313 | 12/14/2021 |
1.0.21 | 689 | 6/6/2021 |
1.0.20 | 385 | 5/31/2021 |
1.0.19 | 473 | 1/16/2021 |
1.0.18 | 557 | 12/6/2020 |
1.0.17 | 538 | 12/5/2020 |
1.0.14 | 465 | 10/8/2020 |
1.0.13 | 498 | 9/23/2020 |
1.0.12 | 504 | 9/16/2020 |
1.0.11 | 483 | 9/14/2020 |
1.0.10 | 532 | 8/31/2020 |
1.0.9 | 457 | 8/24/2020 |
1.0.8 | 483 | 8/18/2020 |
1.0.7 | 468 | 8/5/2020 |
1.0.6 | 511 | 7/19/2020 |
1.0.5 | 4,327 | 7/19/2020 |
1.0.4 | 455 | 7/16/2020 |
1.0.3 | 599 | 6/27/2020 |
1.0.2 | 686 | 3/29/2020 |
1.0.1 | 637 | 12/18/2019 |
1.0.0 | 547 | 12/18/2019 |