Monday, June 4, 2012

Static, when to use

Ever wondered when we see STATIC modifier in code, "what is it?". This article explains when to use it and beauty of it. A MUST go through for all who love to write aesthetic code.

http://www.codeproject.com/Articles/15269/Static-Keyword-Demystified

Summary: Declare methods or variables or properties as static when you think you don't need an object to access the corresponding. Static classes are different in different languages. In C# declaring a class to be static means that it contains only static members. So, recommendation is that write all generic and helper functions in a static class.

No comments:

Post a Comment