title: What happens when ToArray() is called on IEnumerable?
body: <p>I'm having trouble understanding what happens when a ToArray() is called on an IEnumerable. I've always assumed that only the references are copied.</p>
  
  <p>I would expect the output here to be:
  true
  true</p>
  
  <p>But instead I get
  true
  false</p>
  
  <p>What is going on here?</p>
  
  <pre><code>class One {
      public bool Foo { get; set; }
  }
  
  class Two
  {
      public bool Foo { get; set; }
  }
  
  void Main()
  {
      var collection1 = new[] { new One(), new One() };
  
      IEnumerable&lt;Two&gt; stuff = Convert(collection1);
  
      var firstOne = stuff.First();
  
      firstOne.Foo = true;
  
      Console.WriteLine (firstOne.Foo);
  
      var array = stuff.ToArray();
  
      Console.WriteLine (array[0].Foo);
  }
  
  IEnumerable&lt;Two&gt; Convert(IEnumerable&lt;One&gt; col1) {
  
      return
          from c in col1
          select new Two() {
              Foo = c.Foo
          };
  }
  </code></pre>