title: C# Access to modified closure
body: <pre><code>public virtual void OnRegistrationJoin(RegistrationJoinEventArgs e)
  {
      foreach (Mobile member in e.Team)
      {
          member.SendMessage(1161, "You join the {0}.", EventFullName);
  
          if (e.Team.Count &gt; 1)
          {
              Joinees.Remove(member);
              member.SendMessage(1161, "Your team formation is:");
  
              int i = 0;
  
              foreach (Mobile parter in e.Team.Where(partner =&gt; partner != member).ToList())
              {
                  member.SendMessage(1150, "{0}: {1}.", ++i, partner.Name);
              }
          }
      }
  
      Members.Add(e.Team);
  }
  </code></pre>
  
  <p>I get "access to modified closure" warning by resharper, I was wondering what's so wrong with this code, since all I do in the inner loop is send a message?</p>