dotnet/roslyn

static readonly autoimplemented property

Open

#16,647 opened on 2017年1月20日

GitHub で見る
 (4 comments) (2 reactions) (0 assignees)C# (4,257 forks)batch import
Area-CompilersBugConcept-Diagnostic Clarityhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

Why does the following code given an error during compilation? public class A { }

public class B
{
    private static A AF { get; }

    public B()
    {
        AF = new A();
    }
}

C# 6.0, .NET 4.5, VS2015 Update 3

Expected Behavior: This code should not give a compiler error

Actual Behavior: error CS0200: Property or indexer 'B.AF' cannot be assigned to -- it is read only

コントリビューターガイド