C# readonly const

        public static readonly int b = a + 1;
        public static readonly int a = 1;

        public static readonly int c = 1;
        public static readonly int d = c + 1;

        public const int f = e + 1;
        public const int e = 1;

        static int x = y + 1;
        static int y = 1;
        static void Main(string[] args)
        {
            Console.WriteLine($"{a},{b}");  //结果1,1
            Console.WriteLine($"{c},{d}");  //结果1,2
            Console.WriteLine($"{e},{f}");  //结果1,2
            Console.WriteLine($"{x},{y}");  //结果1,1
        }

 

posted @ 2024-09-06 13:51  竹楼风雨声  阅读(1)  评论(0编辑  收藏  举报