ObjectTreeWalker 0.11.1
dotnet add package ObjectTreeWalker --version 0.11.1
NuGet\Install-Package ObjectTreeWalker -Version 0.11.1
<PackageReference Include="ObjectTreeWalker" Version="0.11.1" />
paket add ObjectTreeWalker --version 0.11.1
#r "nuget: ObjectTreeWalker, 0.11.1"
// Install ObjectTreeWalker as a Cake Addin #addin nuget:?package=ObjectTreeWalker&version=0.11.1 // Install ObjectTreeWalker as a Cake Tool #tool nuget:?package=ObjectTreeWalker&version=0.11.1
ObjectGraphWalker
ObjectGraphWalker is a powerful utility library that enables seamless traversal over C# object properties and fields, Node.js style. Designed with performance and flexibility in mind, it leverages dynamic code generation and caching to provide efficient traversal capabilities.
Features
- Fast Traversal: Utilizes dynamic code generation to create accessors that speed up traversal.
- Flexible Filtering: Allows custom predicates to include or exclude specific members during traversal.
- Support for Various Types: Works with both value and reference types, including generics and embedded structs.
- Well-Tested: Includes comprehensive tests to ensure reliability and correctness.
Installation
Simply install the NuGet Package
Usage Examples
Simple Example
A basic example that demonstrates how to traverse an object and access its properties:
var someObject = new SomeObject();
var iterator = new ObjectMemberIterator();
iterator.Traverse(someObject, (in MemberAccessor accessor) =>
{
var propertyValue = accessor.GetValue();
prop.SetValue(/* some other value */);
});
Advanced Example
An advanced example that shows how to use predicates to filter members and control the traversal behavior:
var someObject = new SomeObject();
var iterator = new ObjectMemberIterator();
iterator.Traverse(someObject, (in MemberAccessor accessor) =>
{
var propertyValue = accessor.GetValue();
prop.SetValue(/* some other value */);
//filtering for selective iteration is a simple lambda
}, (in MemberAccessor accessor) => accessor.Name != "Foo1" && accessor.MemberType != MemberType.Property);
Notes
- The iterator will read public and private properties and fields but will ignore any static members of the object.
- The iterator will ignore backing fields for "auto properties" and any compiler-generated fields such as closures (unless specified in the constructor).
- While the iterator is well-tested, there may be some bugs. If you encounter any issues, please open an issue with a description.
Contributing
Any contributions are welcome 😃
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.ObjectPool (>= 8.0.4)
- Sigil (>= 5.0.0)
- System.Memory (>= 4.5.5)
-
net6.0
- Microsoft.Extensions.ObjectPool (>= 8.0.4)
- Sigil (>= 5.0.0)
- System.Memory (>= 4.5.5)
-
net8.0
- Microsoft.Extensions.ObjectPool (>= 8.0.4)
- Sigil (>= 5.0.0)
- System.Memory (>= 4.5.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ObjectTreeWalker:
Package | Downloads |
---|---|
RoguelikeToolkit.Entities
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.11.1 | 201 | 4/25/2024 |
0.11.0 | 107 | 4/25/2024 |
0.10.18 | 528 | 8/21/2023 |
0.10.14 | 154 | 7/6/2023 |
0.10.13 | 149 | 5/27/2023 |
0.10.11 | 190 | 4/4/2023 |
0.10.8 | 405 | 1/14/2023 |
0.10.7 | 273 | 1/14/2023 |
0.10.5 | 284 | 12/25/2022 |
0.10.4 | 288 | 12/24/2022 |
0.10.3 | 1,973 | 12/3/2022 |
0.10.2 | 308 | 12/3/2022 |
0.9.4 | 312 | 11/29/2022 |
0.9.3 | 290 | 11/29/2022 |
0.9.2 | 481 | 11/7/2022 |
0.9.1 | 425 | 10/20/2022 |
0.9.0 | 413 | 10/19/2022 |
0.8.3 | 392 | 10/19/2022 |
0.8.2 | 453 | 9/26/2022 |
0.8.1 | 421 | 9/26/2022 |
0.8.0 | 394 | 9/26/2022 |
0.7.1 | 414 | 9/24/2022 |
0.7.0 | 548 | 9/24/2022 |
0.6.0 | 436 | 9/24/2022 |
0.5.3 | 412 | 9/24/2022 |
0.5.2 | 400 | 9/24/2022 |
0.4.1 | 462 | 9/17/2022 |
0.3.3 | 441 | 9/17/2022 |
0.3.1 | 445 | 9/17/2022 |
:bug: Bug Fixes:
- [`bbfc4ca`](https://github.com/myarichuk/Library.Template/commit/bbfc4ca34650fca71e86bbaa3c177ca892bccf85) - ensure release is created (add missing parameter) *(commit by [@myarichuk](https://github.com/myarichuk))*
[v1.0.10.0]: https://github.com/myarichuk/Library.Template/compare/v1.0.9.0...v1.0.10.0