fork download
  1. using System;
  2.  
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. Console.WriteLine("Before");
  8.  
  9. StaticClass.Method();
  10.  
  11. Console.WriteLine("After");
  12. }
  13. }
  14.  
  15. static class StaticClass
  16. {
  17. static StaticClass()
  18. {
  19. Console.WriteLine("静的コンストラクタが呼ばれました");
  20. }
  21.  
  22. public static void Method()
  23. {
  24. Console.WriteLine("静的メソッドが呼ばれました。");
  25. }
  26. }
Success #stdin #stdout 0.02s 34728KB
stdin
Standard input is empty
stdout
Before
静的コンストラクタが呼ばれました
静的メソッドが呼ばれました。
After