When to use static methods?

less than 1 minute read

This is a question that hanuts me since I installed Resharper recently. Resharper keeps suggesting that the method can be static. I can see that it can be static. The method does not depend on any properties or methods of the class. But does that mean it should change to static?

I wasn't sure, so I asked google. Often, I think google is like a wizard or rabbi. I ask a question, and it answers. Anyway, there were people who were curios and thought about it.

Kristofer Gafvert says,

Does this method belong to an object, or the class itself?
A method belongs to an object, if it modifies the state of the object. If
the method does not modify a specific object, it can most likely be static.

I really agree. if the method does not modifies the state of the object, it just belongs to the class, not the object. What do you think?

Please have a look on this discussion.