Advantages of static class over class ?

When to use static class and when to use normal class ?

Questions by sambomb3

Showing Answers 1 - 9 of 9 Answers

Knoxille_25

  • Aug 19th, 2014
 

A static class can make your implementation simpler and faster because you do not have to create an object in order to call its methods. It is useful to organize the methods inside the class in a meaningful way, such as the methods of the Math class in the System namespace.

Knoxille_25

  • Aug 19th, 2014
 

A static class can make your implementation simpler and faster because you do not have to create an object in order to invoke its methods. It is useful to organize the methods inside the class in a meaningful way, such as the methods of the Math class in the System namespace.

Sunil

  • Aug 31st, 2014
 

WHEN SHOULD WE DO THIS: When we have a normal class and its methods being used very frequently in a given app, then it would speed up things if we made this class a static class with static methods. This is because there is always a cost incurred in terms of resource usage ( CPU, memory, time) EVERY TIME a normal class is instantiated, whereas for static class its only a ONE-TIME cost when static constructor is FIRST called.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions