While not positive, I'm pretty sure the static keyword makes methods and fields belong to a class and not an instance of a class. For fields, this makes sense to me, as static fields become global variables essentially. For methods though, I don't understand why it would be advantageous or hurtful to make a static method.
For example, what would be the difference between:
class RandomClass {
public static void Method() {
Console.WriteLine("Hello World");
}
}
class Program {
static void Main(string[] args) {
RandomClass.Method();
}
}
and
class RandomClass {
public void Method() {
Console.WriteLine("Hello World");
}
}
class Program {
static void Main(string[] args) {
RandomClass randomObject = new RandomClass();
randomObject.Method();
}
}