Static contructor

Isn’t it weird that

A static constructor is run once per type, not per instance. It is invoked before the type is instantiated

public static void Main() {
  Forest f  = new Forest(); 

but at the same time

In C#, a static class cannot be instantiated. Its members are accessed by the class name.

I think there’s a few things to consider. static can apply to a few types of objects.

It’s alright for this to be confusing. static is a relatively advanced concept.
Variables can also be static, and maybe some other things I can’t think of right now.

1 Like