How to know if read only property can be set in constructor? #71743
-
Given the // can be set in the constructor
public string P1 { get; }
// can't be set in constructor
public string P2 => "zzz"; In both cases, the |
Beta Was this translation helpful? Give feedback.
Answered by
CyrusNajmabadi
Jan 20, 2024
Replies: 1 comment 1 reply
-
Look at the property and see if there is an associated field. If so, it is an autoprop and can be set |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
gao-artur
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Look at the property and see if there is an associated field. If so, it is an autoprop and can be set