ObjectTreeWalker 0.10.13
See the version list below for details.
dotnet add package ObjectTreeWalker --version 0.10.13
NuGet\Install-Package ObjectTreeWalker -Version 0.10.13
<PackageReference Include="ObjectTreeWalker" Version="0.10.13" />
paket add ObjectTreeWalker --version 0.10.13
#r "nuget: ObjectTreeWalker, 0.10.13"
// Install ObjectTreeWalker as a Cake Addin #addin nuget:?package=ObjectTreeWalker&version=0.10.13 // Install ObjectTreeWalker as a Cake Tool #tool nuget:?package=ObjectTreeWalker&version=0.10.13
The What
ObjectGraphWalker is a simple utility library that allows traversing over C# object properties, Node.js style. Under the hood, the class generates accessors that would speed up the traversal.
The How
Simply instantiate the class and use the ObjectMemberIterator::Traverse()
method.
var someObject = new SomeObject();
var iterator = new ObjectMemberIterator();
iterator.Traverse(someObject, (in MemberAccessor accessor) =>
{
var propertyValue = accessor.GetValue();
prop.SetValue(/* some other value */);
});
Note 1: it is also possible to use predicate
parameter in the ObjectMemberIterator::Traverse()
method to exclude some members from the iteration. The following example iterates over all fields and properties if their name is not Foo1
var someObject = new SomeObject();
var iterator = new ObjectMemberIterator();
iterator.Traverse(someObject, (in MemberAccessor accessor) =>
{
var propertyValue = accessor.GetValue();
prop.SetValue(/* some other value */);
}, (in MemberAccessor accessor) => accessor.Name != "Foo1");
Note 2: it is possible to filter for member types (iterate only on properties or fields), like shown in the following code
iterator.Traverse(someObject, (in MemberAccessor accessor) =>
{
// do some operations or mutate data
}, (in MemberAccessor accessor) => 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 work on both value and reference types
- The iterator will ignore backing fields for "auto properties" and it will ignore any compiler generated fields such as closures (unless specified in the constructor)
- The iterator is fairly well tested by there may be some bugs. If you do see something weird, I'd appreciate an opened issue with a description 😃
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 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 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.ObjectPool (>= 7.0.5)
- Sigil (>= 5.0.0)
- System.Memory (>= 4.5.5)
-
net6.0
- Microsoft.Extensions.ObjectPool (>= 7.0.5)
- 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 | 209 | 4/25/2024 |
0.11.0 | 111 | 4/25/2024 |
0.10.18 | 546 | 8/21/2023 |
0.10.14 | 158 | 7/6/2023 |
0.10.13 | 153 | 5/27/2023 |
0.10.11 | 194 | 4/4/2023 |
0.10.8 | 409 | 1/14/2023 |
0.10.7 | 277 | 1/14/2023 |
0.10.5 | 288 | 12/25/2022 |
0.10.4 | 292 | 12/24/2022 |
0.10.3 | 1,978 | 12/3/2022 |
0.10.2 | 312 | 12/3/2022 |
0.9.4 | 316 | 11/29/2022 |
0.9.3 | 294 | 11/29/2022 |
0.9.2 | 485 | 11/7/2022 |
0.9.1 | 429 | 10/20/2022 |
0.9.0 | 417 | 10/19/2022 |
0.8.3 | 396 | 10/19/2022 |
0.8.2 | 457 | 9/26/2022 |
0.8.1 | 425 | 9/26/2022 |
0.8.0 | 398 | 9/26/2022 |
0.7.1 | 418 | 9/24/2022 |
0.7.0 | 552 | 9/24/2022 |
0.6.0 | 440 | 9/24/2022 |
0.5.3 | 416 | 9/24/2022 |
0.5.2 | 404 | 9/24/2022 |
0.4.1 | 466 | 9/17/2022 |
0.3.3 | 445 | 9/17/2022 |
0.3.1 | 449 | 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