using System; //static_constructor.cs public class stat_construct { private static string strstat_construct; //public stat_construct() { Console.WriteLine("constructor evoked"); } ~stat_construct() { Console.WriteLine("destructor evoked"); } static stat_construct() { Console.WriteLine("constructor evoked"); strstat_construct = "Hello World"; } // call a variable that is set within a //static constructor with a public method // i don't see much use of it now //any way i know it can be used public void writestat_construct() { Console.WriteLine(strstat_construct); } } class test { public static void Main() { stat_construct sc = new stat_construct(); sc.writestat_construct(); } } |