类初始化成员加载测试


 public class SS
    {
        public static int ss = getNum();

        public static int age = 23;

        private static int getNum()
        {
            return age;
        }
    }

  public class KK
    {
        public KK()
        {
            Console.WriteLine("55555");
            wsd = 66666;
        }

        private static string fds = null;

        public static string FDS
        {
            get
            {
                return fds = MSS.Dof();
            }
        }

        public int wsd;
        public static int ddddddds()
        {
            Console.WriteLine("1111111");
            return 77777;
        }
    }


 public class MSS
    {
        public static int dd = KK.ddddddds();

        public static string Dof()
        {
            Console.WriteLine("33333");
            return "444444";
        }

    }


class Program
    {
        static void Main(string[] args)
        {
            Test();

            Console.Read();
        }

        public static void Test()
        {
            Console.WriteLine("222222");
            Console.WriteLine(KK.FDS);
            Console.WriteLine(new KK().wsd);
            Console.WriteLine(MSS.dd);


            Console.WriteLine(SS.ss);

            //Console.WriteLine("33333");
            //int kkk = KK.fds;
            //int hhh = new KK().wsd;
            //int ppp = MSS.dd;
            //Console.WriteLine(kkk);
            //Console.WriteLine(hhh);
            //Console.WriteLine(ppp);
        }
    }

lei

猜你喜欢

转载自www.cnblogs.com/wwkk/p/9142870.html