I have two classes Class A and ClassB:
static class ClassA
{
static string SomeMethod()
{
return "I am a Static Method";
}
}
class ClassB
{
static string SomeMethod()
{
return "I am a Static Method";
}
}
I want to know what is the difference between ClassA.SomeMethod();
and ClassB.SomeMethod();
When they both can be accessed without creating an instance of the class, why do we need to create a static class instead of just using a non static class and declaring the methods as static?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…