Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Dealing with paths through nullable objects #5

Closed
statler opened this issue Feb 16, 2018 · 2 comments
Closed

Dealing with paths through nullable objects #5

statler opened this issue Feb 16, 2018 · 2 comments

Comments

@statler
Copy link

statler commented Feb 16, 2018

Inevitably, when using the path through an object, you come across the case where an object in the path is null. As expected this causes an exception. Is there any way to deal with this in a similar way to the c#6 syntax e.g. myproperty?.mySubproperty

Really handy little library by the way :)

@Domysee
Copy link
Owner

Domysee commented Feb 20, 2018

It would definitely be possible to support the same syntax as the null conditional operator in C#.
Another way would be to add an extra method, ResolveSafe, which doesn't throw exceptions, but returns null.

I'm not sure yet which the better option is, but this sure is a good feature to add.

@Domysee
Copy link
Owner

Domysee commented Feb 23, 2018

This is done now, in version 2.1.0, Resolver has a ResolveSafe method.

@Domysee Domysee closed this as completed Feb 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants