✅ Required Member must be set in the object initializer or attribute constructor
give a compile error
the class in question
if my constructor sets it, why do I get the compile error? Is there some way to avoid besides the following
4 Replies
Don't mark the property with
required
if the only constructor on the type is going to set it
The point of required
is to shift the responsibility of initializing a property to the person using the constructor
If there's only one constructor, and it takes care of it, then you don't need required
I see
thanks
You're welcome. If you have any other questions about
required
feel free to ask, otherwise you can go ahead and $close this thread 🙂If you have no further questions, please use /close to mark the forum thread as answered