© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
4 replies
FusedQyou

❔ Check if Type is static

This question is probably vague as shit, but I always do this check to ensure a type is static:
private bool IsStatic(Type type)
{
  return type.IsAbstract && type.IsSealed;
}
private bool IsStatic(Type type)
{
  return type.IsAbstract && type.IsSealed;
}

So, this works because static classes are declared abstract and sealed at the IL level.
My question is if this is actually valid and won't fail, ever. C# doesn't exactly have a
isStatic
isStatic
field or something.
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

Check if an object is a Dictionary of any type
C#CC# / help
2y ago
✅ Check if port is up
C#CC# / help
4y ago
✅ Check if value is within range, throw exception if not
C#CC# / help
16mo ago