【发布时间】:2012-07-05 13:41:06
【问题描述】:
有这样的代码:
public static readonly bool MaximumRecipientsReached;
private static readonly IList<EmailAddress> Contacts;
static AdditionalRecipient()
{
Contacts = AnotherClass.Contacts; //works
}
public AdditionalRecipient()
{
MaximumRecipientsReached = true; //works not
}
为什么我可以更改私有静态只读字段但不能更改公共字段?
PS:我当然是在使用属性。
【问题讨论】:
-
您收到的错误信息是什么?
标签: c# .net constructor readonly static-constructor