Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use static classes and methods?

I have a general question...when should i be using static classes or static methods?.. I know the idea that static methods can be called without instantiating...and static classes should only be used for static methods?...but are there any performance concerns also with it...and when should they be preferred over instance methods and classes?..If someone could just briefly mention when i should opt for using them and when i should avoid them?

like image 756
Vishal Avatar asked Jul 14 '10 23:07

Vishal


1 Answers

I think the following two links offer a clear answer for what you're looking for. Take a look at them:

For static classes:

When to Use Static Classes in C#

For static methods:

When is it appropriate to use static methods? ( Jon Skeet [the Guru] answered this one :o) )

like image 145
Leniel Maccaferri Avatar answered Oct 11 '22 12:10

Leniel Maccaferri