CSharp - Will the code compile: readonly and constructor

Question

Will the code compile

class ReadOnlyEx
{
    public readonly int myReadOnlyValue = 105;
    public int MethodA()
    {
        myReadOnlyValue++;
    }
    //Some other code e.g.Main method() etc..
}


Click to view the answer

No.

Note

You can change the value through a constructor only.

MethodA() is not the constructor here.