There is no better way to avoid NullRefenrenceException other than try / catch
that means
x = & gt; X.Child.GChild.GChildProp1
If the child or GBL should be empty, then it will increase NullRefenrenceException
Other solutions that spread to the head, each of them
OK, you Instead of a representative, that representative can convert that expression tree, and can navigate it carefully. But no, there is nothing like "empty-safe detaining operator" in C # I have gathered the C # team and there is something in it that actually works with the way you naturally want it It is difficult to say it is not to say that they will not take another look at a later date, of course :)
(It definitely seems seems one Applying the simplest language feature For ... but I trust the team when they say that there are hidden complications!)
I do not really catch it in a way like a NullReferenceException
Wanted ... I liked to write a method that was clearly checked for blank references for a particular case. It depends on your situation.
Comments
Post a Comment