question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How hard would it be to add nested property access?

See original GitHub issue

I 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:open
  • Created 7 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

1reaction
beachwalkercommented, Oct 28, 2016

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.

1reaction
PhilipDanielscommented, Aug 15, 2016

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found