Things every programmer should know #1

Things every programmer should know #1

Oct 28, 2020

Why would you use a static constructor?

If you create a new object, the static data resets. Really. Try it out:

  • Update a static data after creating an object.

  • Then create another object and watch (in despair) the static data resetting to its original value.


How to deal with it? Use a static constructor.

Vous aimez cette publication ?

Achetez un livre à fmachs

More from fmachs