Cannot set readonly field in inherited constructor [Answered]
Title says it all really, I'm not really sure why given this is clearly a constructor.
7 Replies
private
means available only in that class
protected
would be available in that class and its descendantsEverything was public though.
Ah, huh, could be because of the
readonly
then..?
Easiest solution would be to just make it a get-only property insteadUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
u can call the base constructor with : base()
if the base constructor sets a value to that readonly field
instead of setting the field with the child constructor
Couldn't you also just use
init
on the property like this?
✅ This post has been marked as answered!