We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Igor Kuna • 3 years ago

Aaa thank you so much for this... very simply put and all I needed to know :)

Ford Prefect • 2 years ago

Honestly I do not like this use of the auto-property generation. Better to be explicit by creating private data fields and public property accessors.

Bart • 1 year ago

I like auto-property generation... who needs boilerplate code?

jgod • 2 years ago

Strongly agree

Ken Dale • 2 years ago


ssfane • 4 years ago

geat, 10x!

BrokenByHer • 5 months ago

Thanks Sir!

Kote Isaev • 1 year ago

I do not understand why we can not something similar across constructor body, like of public/private/protected used inside constructor, like public name = options.name; autodeclare field instead of typing it twise - as declaration and.at in-constructor assignment.

Gary Oberbrunner • 2 years ago

How does this work with derived classes (child extends parent)?

Tammar • 2 years ago

Neat feature!

Carlos Soares Dias • 2 years ago

Super objetive. Super effective.

David Barbakadze • 2 years ago

What if I pass my arguments as an object, can I deconstruct the object and create and assign private/public properties simultaneously?

Mathieu • 2 years ago

Same question here, I'd say no.

Philia Development • 1 year ago

The answer is no, we use a pattern where we do this, and have a `static` method for manufacturing the constructor.

static from({prop1, prop2}) => new this(public prop1, public prop2)

Sarvar • 3 years ago

Thanks man for this

Nelson Mokoena • 3 years ago

1000x loved it.

Niki Herl • 3 years ago

nice, thanks.