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

Igor Kuna • 5 years ago

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

Ford Prefect • 3 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 • 3 years ago

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

jgod • 3 years ago

Strongly agree

Ken Dale • 3 years ago


Victor Posmagel • 7 months ago


Sarvar • 4 years ago

Thanks man for this

ssfane • 5 years ago

geat, 10x!

Hyunjin Kim • 7 months ago

good post

BrokenByHer • 1 year ago

Thanks Sir!

Kote Isaev • 3 years 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 • 3 years ago

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

Tammar • 3 years ago

Neat feature!

Carlos Soares Dias • 4 years ago

Super objetive. Super effective.

David Barbakadze • 4 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 • 4 years ago

Same question here, I'd say no.

Philia Development • 3 years 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)

Nelson Mokoena • 4 years ago

1000x loved it.

Niki Herl • 4 years ago

nice, thanks.