[Solved] What is the difference between a static and a non-static class? [duplicate]


The first class is static, which means:

  • You can’t use it as a type argument
  • You can’t use it as a variable type
  • It will have no instance constructors (whereas your non-static class implicitly has a public parameterless constructor)
  • It will be implicitly abstract and sealed (even though that combination can’t be static
  • It cannot contain any non-static members
  • It can contain extension methods (if it’s a top level, non-generic static class)

Basically for utility classes which are only meant to contain static members, using a static class expresses that intent clearly and lets the compiler help you enforce that usage.

2

solved What is the difference between a static and a non-static class? [duplicate]