How hard would it be to add nested property access?
See original GitHub issueI have some similar code (though based on a different technique) which allows you to access properties nested on a hierarchical object model, for example - using your syntax:
var acc = ObjectAccessor.Create(someObject);
acc["Building.Address.Postcode"] = "SL6 2AA";
acc["Building.Rooms[5].FloorArea"] = 75;
I was wondering how easy it would be to add such functionality into FastMember, since it would be nice to get the benefits of using a more well known package rather than my own hand-rolled code.
The second API I support allows you to retrieve the actual PropertyInfo we are dealing with:
var pi = acc.GetProperyInfo("Building.Address.Postcode")
Which FastMember doesn’t seem to support at the moment.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:8
Top Results From Across the Web
Object nested property access - javascript
As you can see from this line: obj[level + "." + p] = o[p]; , I am simply adding the values as new...
Read more >JavaScript Object Nested Properties
Access Nested Properties using Variable in JavaScript ... Another way to access the nested properties is by storing them into variables and then...
Read more >This Trick Changed the Way I Access Nested Objects in ...
It completely changed the way I access nested objects. Hopefully this trick is as helpful to you as it was for me.
Read more >Accessing Nested Objects in JavaScript
Access Nested Objects Using Array Reduce Array reduce method is very powerful and it can be used to safely access nested objects. const ......
Read more >Safely Read & Write in Deeply Nested Objects in Javascript
Conclusion. Coding is fantastic but making it right isn't easy. I truelly hope this brief insight on how I handle deep nested properties...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I have posted my solution here: http://stackoverflow.com/questions/40305645/how-to-set-nested-property-value-using-fastmember
Anyway, out of the box support (e.g. extension method like I did in the example?) would be nice.
@piotrkula-brother Not available publicly I am afraid but I can give you a hint - check out the reference source for the DataBinder class. http://referencesource.microsoft.com/#System.Web/UI/DataBinder.cs,bc4362a9cfc4c370