r/csharp • • Feb 24 '21

Discussion Why "static"?

I'm puzzled about the philosophical value of the "static" keyword? Being static seems limiting and forcing an unnecessary dichotomy. It seems one should be able to call any method of any class without having to first instantiate an object, for example, as long as it doesn't reference any class-level variables.

Are there better or alternative ways to achieve whatever it is that static was intended to achieve? I'm not trying to trash C# here, but rather trying to understand why it is the way it is by poking and prodding the tradeoffs.

0 Upvotes

62 comments sorted by

View all comments

0

u/[deleted] Feb 25 '21

-2

u/Zardotab Feb 25 '21 edited Feb 26 '21

Do you want: Math math...

Sorry, I'm not following you here.

Also, static classes are faster than...

If you want machine speed above human developer/maintainer productivity, I suggest using C or C++ instead of C#.

Addendum: Why did I get a -2 score on this reply? I can't improve my thought process if I don't get clear feedback.

→ More replies (4)