title: ModelStateDictionary does not contain a definition for CopyTo
body: <p>In ASP.NET Core RC 1 (full .NET Framework) works for me the following code:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using Microsoft.AspNet.Mvc;
  using Microsoft.AspNet.Mvc.Filters;
  using Microsoft.AspNet.Mvc.ModelBinding;
  using Newtonsoft.Json;
  
  namespace MyProject.Classes.Filters.ModelState
  {
      public class SetTempDataModelStateAttribute : ActionFilterAttribute
      {
          public override void OnActionExecuted(ActionExecutedContext filterContext)
          {
              base.OnActionExecuted(filterContext);
  
              var controller = filterContext.Controller as Controller;
              if (controller != null)
              {
                  var modelState = controller.ViewData.ModelState;
                  if (modelState != null)
                  {
                      var dictionary = new KeyValuePair&lt;string, ModelStateEntry&gt;[modelState.Count];
                      modelState.CopyTo(dictionary, 0);
                      var listError = dictionary.ToDictionary(m =&gt; m.Key, m =&gt; m.Value.Errors.Select(s =&gt; s.ErrorMessage).FirstOrDefault(s =&gt; s != null));
                      controller.TempData["ModelState"] = JsonConvert.SerializeObject(listError);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>But in ASP.NET Core 1.0 (full .NET Framework), an error occurs:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.AspNetCore.Mvc.Filters;
  using Microsoft.AspNetCore.Mvc.ModelBinding;
  using Newtonsoft.Json;
  
  namespace MyProject.Models.ModelState
  {
      public class SetTempDataModelStateAttribute : ActionFilterAttribute
      {
          public override void OnActionExecuted(ActionExecutedContext filterContext)
          {
              base.OnActionExecuted(filterContext);
  
              var controller = filterContext.Controller as Controller;
              if (controller != null)
              {
                  var modelState = controller.ViewData.ModelState;
                  if (modelState != null)
                  {
                      var dictionary = new KeyValuePair&lt;string, ModelStateEntry&gt;[modelState.Count];
                      modelState.CopyTo(dictionary, 0);
                      modelState = dictionary.[0];
                      var listError = dictionary.ToDictionary(m =&gt; m.Key, m =&gt; m.Value.Errors.Select(s =&gt; s.ErrorMessage).FirstOrDefault(s =&gt; s != null));
                      controller.TempData["ModelState"] = JsonConvert.SerializeObject(listError);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>'ModelStateDictionary' does not contain a definition for 'CopyTo' and
    no extension method 'CopyTo' accepting a first argument of type
    'ModelStateDictionary' could be found (are you missing a using
    directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Maybe I need to connect a new reference to an assembly that is not needed in ASP.NET Core RC 1?</p>