62,046
社区成员
发帖
与我相关
我的任务
分享
//配置类A和B
public class A
{
private static readonly string key = "9527"; //或丢在静态构造函数中
public static string Key
{ get { return key; } }
}
public class B
{
public const string Key = "9527";
}
/////////////////////////////
public void test()
{
string _const = A.Key;
string _readonly = B.Key;
}