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
- public class NormalClassA
- {
- }
- public static class StaticClassC : NormalClassA //Error -cannot inherit from NormalClassA class
- {
- }
- public static class StaticClassD : StaticClassC //Error -cannot inherit a static class as static class is sealed by //default
- {
- }
Below is error description.


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.
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.



Hamid KhanPosted Mar 6, 2019, 5:28 AM
Good explanation Vikas Thanks for it...……. keep growing...….
Sagar Pandurang KapPosted Jan 2, 2018, 5:41 AM
Good going.Nice article.Well defined.