110,529
社区成员
发帖
与我相关
我的任务
分享
using System;
class P
{
static readonly int A=B*10;
static readonly int B=10;
public static void Main(string[] args)
{
Console.WriteLine("A is {0},B is {1} ",A,B);
}
}
using System;
class P
{
const int A=B*10;
const int B=10;
public static void Main(string[] args)
{
Console.WriteLine("A is {0},B is {1} ",A,B);
}
}
声明readonly输出的是0和10
声明const输出的是10和100
但如果把readonly中声明A和B的位置换一下。。输出的结果也是10和100。。
看到这里应该明白了吧?