And now we have everything we need to determine what’s the problem in your code. You have a circular reference between House
and HOUSING
. In order to initialize HOUSING
we need to initialize House
, but to initialize House
we need to have HOUSING
initialized already.
Honestly, it seems pretty strange that we can create many different instances of House
, but HOUSING
keeps a very specific instance for itself. Why do you need this buildings
property? Why do you need House
class and HOUSING
enum separately? Maybe you should use sealed classes instead of enums?