static int _i;
static void Display()
{
//operates on _i;
}
AND
static int _i;
void Display()
{
//operates on _i;
}
Which are the scenarios where being specific about method’s static-nonstatic-ness matter?
Edit; Note: This question is not about differences between static and non static methods as many seem to answer. The question is what are the scenarios/use-cases where I should be worrying about the differences. For clarity see @ziesemer’s answer which seem to exactly address it.
Non-static functions would allow you to create a subclass of the class containing the functions, providing overridden methods for one or more of the methods – providing an option for extensibility and customization. This won’t work with non-static functions. On the other hand, non-static functions require you to first create an instance of the class before calling its functions.
I’d also revisit why you have static variables for everything, and encourage you to revisit – instead making everything non-static. This will allow you to have multiple, independent instance of everything within the same runtime. By making your variables static, you are essentially forcing everyone to use the same configuration (or whatever your variables store) – even if they create multiple instances of the containing class.