How often should I use static methods generally? If I have like:
Class1 _class34 = new Class1(parameter);
Class1.DoSomething(_class34, parameter1, parameter2, parameter3, parameter4).
or
_class34.DoSomething(parameter1, parameter2, parameter3, parameter).
I’m having a tendency of calling static method of a class and passing an object of the class like in the first example?
What is the best practice concerning these two examples? Is there any performance, design and general practices things I should pay attention to? Which one should I use generally and which one would you choose like in every day coding scenarios. The first example seems more simple to read (you pass all the parameters and do something), in the second you have to read twice that you are working on an object?
It is not really a big deal, just wondering.
Generally speaking, static methods should only be used when whatever you want to do is independent of any one instance of the class. If you need to directly access or affect the state of a particular instance, a non-static method is usually the way to go.