A static class cannot be derived from a non-static as well as static class. Static classes are by default sealed so you cannot inherit them. It can only inherit the Object class.
Code Snippet
  1. public class NormalClassA
  2. {
  3. }
  4. public static class StaticClassC : NormalClassA //Error -cannot inherit from NormalClassA class
  5. {
  6. }
  7. public static class StaticClassD : StaticClassC //Error -cannot inherit a static class as static class is sealed by //default
  8. {
  9. }
Below is error description.

error
You cannot declare an instance field inside static class(outside non-static method and constructor).But you can use an instance variable inside static constructor and static method.

You can declare a read-only static variable in static class but it can only be changed in a non-static constructor. But you cannot change the read-only static variable from inside a static method.

You can declare and initialize a constant variable inside static class once and thereafter it can't be changed.

You cannot have non-static constructor inside a static class. Since we can't create an object of the static class to invoke it.

You can declare a static variable at first inside the static class which can be later initialized/changed from inside a constructor and/or from a static method.

Below is code snippet.
  1. public static class StaticClassD
  2. {
  3. // All commented code below gives error on compile time and their reason is written against each of them
  4. //readonly int j; //Error - cannot declare an instance member in static class
  5. // int z; //Error - cannot have instance field outside static function or constructor
  6. readonly static int k; //default value is 0
  7. static int n; //default value is 0
  8. const int i = 90; //need to initialize at declaration and cannot change later
  9. //k++; //Error - readonly static can only change in static constructor
  10. //test() { } //Error - cannot have instance/non-static constructor
  11. static StaticClassD() { k++; n++; int data = 9; } //by default constructor is public //can use instance field insdie ctor
  12. //public void add() { } //Error - cannot have instance method inside static class
  13. public static void ChangedTextStaticMethod()
  14. {
  15. int d = 88;
  16. //k++; //Error - static readonly can only change in static constructor
  17. n++;
  18. Console.WriteLine("Value of static readonly variable k is :"+ k);
  19. Console.WriteLine("Value of static variable n is :" + n);
  20. Console.WriteLine("Value of constat variable i is :" + i);
  21. Console.WriteLine("Value of instance variable d is :" + d);
  22. }
  23. class Program
  24. {
  25. static void Main(string[] args)
  26. {
  27. StaticClassD.ChangedTextStaticMethod();
  28. }
  29. }
Below is output.

output
Static default constructor execution order is from bottom to top (child to parent). And, Non-Static default constructor execution order is from top to bottom (parent to child).
Below is the code snippet.
  1. class NormalClassB
  2. {
  3. static NormalClassB()
  4. {
  5. Console.WriteLine("Static constructor of NormalClassB Called");
  6. }
  7. public NormalClassB()
  8. {
  9. Console.WriteLine("Non-Static constructor of NormalClassB Called");
  10. }
  11. }
  12. class NormalClassC :NormalClassB
  13. {
  14. static NormalClassC()
  15. {
  16. Console.WriteLine("Static constructor of NormalClassC Called");
  17. }
  18. public NormalClassC()
  19. {
  20. Console.WriteLine("Non-Static constructor of NormalClassC Called");
  21. }
  22. }
  23. class Program
  24. {
  25. static void Main(string[] args)
  26. {
  27. // static constructor will be called first - bottom to top
  28. // non-static constructor will be called after all static constructor - top to bottom
  29. NormalClassC normalClassC = new NormalClassC();
  30. }
  31. }
Below is output screen.

output