Posted in C#, Object Oriented Programming, Static

Static keyword in C#

Static class cannot be instantiated using the “new” keyword

 

Static items only access other static items. Share resources between multiple users

 

Static constructor in non-static class: runs only once when class instantiated first time

 

In static class: runs only once when any of its static members accessed for the first time
Static members are allocated in high frequency heap area of the memory

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s