when to make a static method c# code example

Example 1: 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;
    }
}

Example 2: c# public static string

public static string saytest = "test";

private static void Main()
{
  Console.WriteLine(saytest);
}