我有一个关于多线程主题的问题,如描述
private List<Email> emails = new List<Email>();
private void AddEmail(Email email)
{
lock (this.emails)
{
this.emails.Add(email);
}
}
private void ReadEmails()
{
foreach (Email email in this.emails)
{
Print(email);
}
}
假设 ReadEmails 方法持续 10 秒,此时调用 AddEmail。那么是否会出现任何错误?