© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
36 replies
Will Pittenger

✅ ✅ Static constructor for C# class not being called

I declared a class, here
X
X
which has a normal constructor and a static constructor. The static constructor isn't being called leaving some critical steps not done. What's going on?
class X
{
  public X()
  {
    // The static constructor wasn't called here
  }
  static X()
  {
    // Critical step that must be done.
  }
}
class X
{
  public X()
  {
    // The static constructor wasn't called here
  }
  static X()
  {
    // Critical step that must be done.
  }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

class constructor in c#
C#CC# / help
12mo ago
Destructor not being called
C#CC# / help
2y ago
❔ Static Field get not called!
C#CC# / help
4y ago
❔ static class
C#CC# / help
3y ago