#314 – Access Modifiers Are Not Allowed on Static Constructors

Because you can’t call a static constructor directly, you can’t include an access modifier (e.g. public, private) when defining a static constructor.  Static constructors are defined without access modifiers.

        static Dog()
        {
            Motto = "We serve humans.  And lick ourselves.";
        }

The compiler will generate an error if you try to include an access modifier.

Advertisements