A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dotnet/csharplang/issues/5563 below:

Open question for semi-auto properties · Issue #5563 · dotnet/csharplang · GitHub

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;
    }
}

The above scenario is a bit related to https://sharplab.io/#v2:EYLgtghglgdgNAFxANwKYCcoDMCeAfAZwXQFcBjBAAgAEBGAdgFgAoAbxcs8qNIsoGVaHLu2ZdxNAMyVYVAAq1KrSgHNUCANyUAvsIlSZMeQCYlq9ZQC8APkoAGLbrFcnegYoAeZtZu7qNrs6c1NJ09AAUspQAJiRgYDgAlG6i+pwA9OmUAEQAwvx2ABwALJIglACCJAgA9gC0UGAADgA2qGCoRqjRlE3oNU0YCDiUAORhAHQeo5RgJERu4pmUwKiUWCQtLSMQBARQKjDdK6hYNehrZDVG/S0yBDT0x7WLXMsIABaXEFsYE9n3SjXbbcD41ADuMBkWEonzWZy2ENgKkoLVgaygDyu8U6CG6E1ewVoEzoAE5wh4JnJjIkNITKMsAHI1PGwj4QKjUOyUBSGIioCA9Gow6mUcFQLaUH7giA4B4EMHgyj5IqlenLC4qCDoaJtPZir5w9BstZoo6A7EdLrRAlBHQsFjaIA===


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