Static
fields can be initialized in two ways. One way is with a static
constructor, which is similar to a standard constructor, but with no
accessibility modifier or arguments: public class Vertex3d
{
private static int _numInstances;
static Vertex3d()
{
_numInstances = 0;
}
...
}
However, because of performance reasons, it is preferable to initialize static fields inline whenever possible, as shown here:
public class Vertex3d
{
private static int _numInstances = 0;
...
}