static methods

T

Tem

Are static methods good for performance when no instance specific
reference/property is called? or is it better to just leave them as
non-static methods?

Tem
 
M

Marc Gravell

The performance aspect isn't terribly exciting - it isn't going to be
a huge factor either way in most code.
However, if a method doesn't relate to any specific instance, then a
static method may be desirable simply from a semantic perpective;
apart from anything else, this avoids the need to have to create an
instance of an object simply to call a method that doesn't care about
that object. The downside is that there is no static polymorphism or
interface implementation.

Marc
 

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

Top