static-classes

Why are my static objects not being instantiated when first access to the static class is a static method on the base class?

I have the following class: public class DocketType : Enumeration<DocketType, int, string> { public static DocketType ChangeOver = new DocketType(1, "Changeover"); public static DocketType Withdrawal = new DocketType(2, "Withdrawal"); public static DocketType Installation = new DocketType(3, "Installation"); private Doc...

Static classes and efficiency

I want to understand the efficiency of static classes as I think my basic thinking in this area might be flawed. I often write code like the following with the assumption that the expensive reflection call will happen less frequently since the private variable will hold the information for the accessor. I'm pretty sure that this is good ...

PHP singleton class structure - Am I doing it right ?

I have a really big script. It has a database class, a base class, a user authentication class, a resellers authentication class, paypal ipn class, a downloads class, and a plugins class The Base class extends database class like this: class Base extends database { var $userid; var $root; var $config function Base...

Type initializer threw an exception

This class is throwing an exception. It doesn't show me the exact line number, but it sounds like it's occurring in the static constructor: static class _selectors { public static string[] order = new[] { "ID", "NAME", "TAG" }; public static Dictionary<string, Regex> match = new Dictionary<string, Regex> { { "ID", new Re...

If a class is blueprint for objects, what about static class?

Reading C# Step by Step, the author mentiones the class is just blueprint for objects and itself is useless. Well, how then comes static classes can work alone? I do understand the concept that static classes cannot be instantiated and exist as one unique instance with its static members. But that ruins, a bit, the metaphor of classes...