#258 – Initializing a Static Variable as Part of Its Declaration

You can initialize a static variable at the time that it is declared.

        private static string LastDogToBark = "NOBODY";

The initialization of the field happens at runtime and is guaranteed to happen prior to the first time that the field is referenced or used.

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a comment