.net static method code example

Example 1: c# static meaning

In general, static means “associated with the class, not an instance”.
// Search c# static review for more detail

Example 2: static class constructor c#

class SimpleClass
{
    // Static variable that must be initialized at run time.
    static readonly long baseline;

    // Static constructor is called at most one time, before any
    // instance constructor is invoked or member is accessed.
    static SimpleClass()
    {
        baseline = DateTime.Now.Ticks;
    }
}

Tags:

Misc Example