0

ASPNetCore 2.2:

In Startup.cs, the Configure property only has {get}, yet it is assigned a reference.

I tried this in a normal .net framework app console, (a very simple "class1" object), and this was not permitted.

public class Startup
    {
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;  // Configuration is readonly?
    }

    public IConfiguration Configuration { get; }

... etc
  • 1
    It is a readonly auto-property. It's assigned from the constructor so it is allowed. – juunas Jun 24 '19 at 12:40
  • Ok thanks. I see there is a duplicate. As soon as I did a search for readonly auto-property, I saw similar questions ... https://stackoverflow.com/questions/34743533/automated-property-with-getter-only-can-be-set-why/34743656 – Excelnoobster Jun 24 '19 at 12:43

0 Answers0