title: Why is an array passed without ref, changed by CopyTo inside the method?
body: <p>As the array parameter is passed without ref-keyword, this code outputs initial value of array (i.e. 1...6):</p>
  <pre class="lang-cs prettyprint-override"><code>using System;
  using System.Linq;
  
  class Program 
  {
      static void Main(string[] args) 
      {
          var arr = new int[] {1, 2, 3, 4, 5, 6};
  
          Rotate(arr, 3);
          
          Console.WriteLine(string.Join(',', arr));
      }
  
      static void Rotate(int[] nums, int k)
      {
          var tail = nums.TakeLast(k).ToArray();
          nums = tail.Concat(nums)
              .Take(nums.Length)
              .ToArray();
      }
  }
  </code></pre>
  <p>It is obvious, because inside the Rotate method there is it's own array with values, copied from the parameter values. And if I want to change arr values in the calling method, I need to pass it to the Rotate method by ref, it works.
  But I don't understand, why if replace assignment with CopyTo() method the parameter behaves as like it is passed by reference:</p>
  <pre class="lang-cs prettyprint-override"><code>static void Rotate(int[] nums, int k)
  {
      var tail = nums.TakeLast(k).ToArray();
  
      tail.Concat(nums)
          .Take(nums.Length)
          .ToArray()
          .CopyTo(nums, 0);
  }
  </code></pre>