public virtual void OnRegistrationJoin(RegistrationJoinEventArgs e)
{
foreach (Mobile member in e.Team)
{
member.SendMessage(1161, "You join the {0}.", EventFullName);
if (e.Team.Count > 1)
{
Joinees.Remove(member);
member.SendMessage(1161, "Your team formation is:");
int i = 0;
foreach (Mobile parter in e.Team.Where(partner => partner != member).ToList())
{
member.SendMessage(1150, "{0}: {1}.", ++i, partner.Name);
}
}
}
Members.Add(e.Team);
}
我通過resharper得到「訪問修改後的閉包」警告,我想知道這段代碼有什麼問題,因爲我在內部循環中做的所有事情都是發送消息?C#訪問被修改的閉包
[Access to Modified Closure](http://stackoverflow.com/questions/235455/access-to-modified-closure)和其他幾個可能的重複。 – adrianbanks 2011-04-03 00:13:00