namespace CA_CycleInvokeStaticVariable
{
    using System;

    class A
    {
        public static int X;
        static A()
        {
            X = B.Y + 1;
        }
    }
    class B
    {
        public static int Y = A.X + 1;
        static B() { }
        static void Main(string[] args)
        {
            Console.WriteLine("X = {0}, Y = {1}", A.X, B.Y);
        }
    }
}
//X = 1, Y = 2

循环调用静态变量,你知道它的结果吗?

循环调用静态变量,你知道它的结果吗?

相关文章:

  • 2022-02-09
  • 2022-12-23
  • 2021-11-07
  • 2021-07-09
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-12-16
猜你喜欢
  • 2021-05-02
  • 2021-07-31
  • 2021-10-11
  • 2021-12-23
  • 2022-02-18
  • 2021-12-14
  • 2021-12-14
相关资源
相似解决方案