Where to use static constructor and static class

  • Thread starter Thread starter Ashok kumar
  • Start date Start date
A

Ashok kumar

dear friends
Can you tell me in which scenario we have to use static class and
static constructor?

Thanks in advance
 
Ashok said:
dear friends
Can you tell me in which scenario we have to use static class and
static constructor?

Use a static class when you want to implement functionality that does
not require per-instance state (i.e. all consumers of the class can
share the state).

Use a static constructor when you need to initialize state in a class
that is shared by all consumers of the class.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top