Should semi-auto properties be treated as auto properties for the purpose of definite assignment?
struct Program { // causes CS0843: // Auto-implemented property must be fully assigned before control is returned to the caller. int P1 { get; set; } int P2 { get => field; set => field = value; } // CS0843? int P3 { get => field; set; } // CS0843? int P4 { get; set => field = value; } // CS0843? public Program(int dummy) { } }
There is also this scenario:
struct Program { struct S1 { public int AutoProp { get; } public int SemiAutoProp { get => field; } public int ManualProp { get => throw null; } } S1 x { get; set; } S1 x2 { get; set; } S1 x3 { get; set; } public Program(int dummy) // Error that x must be assigned, no error on x3. What should x2 do? { _ = x.AutoProp; _ = x2.SemiAutoProp; _ = x3.ManualProp; } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4