17 Initialization
Initialization is the operation of setting up an instance of a type. It entails giving each stored property an initial value and may involve other preparatory work. After this process, the instance is prepared and available to use.
The types that you have been creating up to this point have all been created in more or less the same way. The values for the properties were either given default stored values or were computed on demand. Initialization was not customized, and it was not particularly considered.
It is very common to want control over how an instance of a type is created. For example, it would be ideal for the instance to have all of the correct values in its properties immediately. Previously, you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access