title: How do you get errors in the ModelState, for a particular property?
body: <p>I'm encountering the following issue: <a href="https://github.com/aspnet/Mvc/issues/4989" rel="noreferrer">https://github.com/aspnet/Mvc/issues/4989</a>, and based on 'rsheptolut' comment on Sep 12, 2016, he found this workaround (pasted for convenience):</p>
  
  <pre><code>&lt;form class="form-horizontal" asp-antiforgery="true"&gt;
    &lt;fieldset&gt;
      // All of this instead of @Html.ValidationSummary(false) due to a bug in ASP.NET Core 1.0
      @if (!@ViewData.ModelState.IsValid)
      {
          var errors = ViewData.ModelState.Values.Select(item =&gt; item.Errors.FirstOrDefault()?.ErrorMessage).Where(item =&gt; item != null);
          &lt;div class="alert alert-danger"&gt;
              &lt;span&gt;@Localizer["There are problems with your input:"]&lt;/span&gt;
              &lt;ul&gt;
                  @foreach (var error in errors)
                  {
                      &lt;li&gt;@error&lt;/li&gt;
                  }
              &lt;/ul&gt;
          &lt;/div&gt;
      }
  
      // Some actual fields. Don't forget validation messages for fields if you need them (@Html.ValidationMessage)
    &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My issue is with the LINQ to get the <code>errors</code> variable. I want to filter these by the name of the property, so the list of errors listed under my file uploads element will not contain errors from other elements on the page. I want to do something like this: </p>
  
  <pre><code>ViewData.ModelState.Values.Where(item =&gt; item.Key == "Images").Select...;
  </code></pre>
  
  <p>However, LINQ doesn't find Key as a valid property of the ModelStateEntry class. Fair enough. But why then, when add a quick watch to <code>ViewData.ModelState.Values</code>, does the Key property show up?</p>