private static void Demo2() { // Force the code in the finally to be eagerly prepared RuntimeHelpers.PrepareConstrainedRegions(); try { Console.WriteLine("In try"); } finally { // Type2’s static constructor is implicitly called in here Type2.M(); } }
private static void Demo2() { Console.WriteLine("In Demo2"); // Force the code in the finally to be eagerly prepared RuntimeHelpers.PrepareConstrainedRegions(); // In the System.Runtime.CompilerServices namespace try { Console.WriteLine("In try"); } finally { // Type2’s static constructor is implicitly called in here Type2.M(); } }
private static void Demo2() { Console.WriteLine("In Demo2"); RuntimeHelpers.PrepareConstrainedRegions(); try { Console.WriteLine("In try"); } finally { Type2.M(); } }