static class vs normal class c# code example
Example 1: static class can have non static member in c#
Static class can't contain non-static members because by definition it can't be instantiated so there's no possibility to use these members. However, static members in non-static class can be used without having class instance - a bit different scenario,
Example 2: static class constructor c#
class SimpleClass
{
static readonly long baseline;
static SimpleClass()
{
baseline = DateTime.Now.Ticks;
}
}
Example 3: c# public static string
public static string saytest = "test";
private static void Main()
{
Console.WriteLine(saytest);
}