Skip to content
Discussion options

You must be logged in to vote

[field: MaybeNull, AllowNull]

You won't need this when teh final form of field is allowed. Standard nullability analysis will do "the right thing (tm)" here, and consider the code ou have inside legal. You will have to write:

public MyProperty MyProperty => field ??= new MyProperty(OtherProp1, OtherProp2, OtherProp3);

TO me this is great. It's clear and simple. The core problem i see with something like lazy is that many developers will have entirely different views on what it would do. And, given that we have a System.Lazy, i think dev will rightly expect the same semantics available there to be present in that language feature.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@thomhurst
Comment options

@CyrusNajmabadi
Comment options

@RikkiGibson
Comment options

Answer selected by CyrusNajmabadi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants