Javatpoint Logo
Javatpoint Logo

C# static constructor

C# static constructor is used to initialize static fields. It can also be used to perform any action that is to be performed only once. It is invoked automatically before first instance is created or any static member is referenced.

Points to remember for C# Static Constructor

  • C# static constructor cannot have any modifier or parameter.
  • C# static constructor is invoked implicitly. It can't be called explicitly.

C# Static Constructor example

Let's see the example of static constructor which initializes the static field rateOfInterest in Account class.


101 Sonoo 9.5
102 Mahesh 9.5
Next TopicC# Structs

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA