Sfoglia il codice sorgente

Reduce delegate invocations and enumeration. (#28468)

Paulo Morgado 5 anni fa
parent
commit
560235080e
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. 1 2
      src/Http/Routing/src/EndpointNameAddressScheme.cs

+ 1 - 2
src/Http/Routing/src/EndpointNameAddressScheme.cs

@@ -73,8 +73,7 @@ namespace Microsoft.AspNetCore.Routing
             // OK we need to report some duplicates.
             // OK we need to report some duplicates.
             var duplicates = endpoints
             var duplicates = endpoints
                 .GroupBy(e => GetEndpointName(e))
                 .GroupBy(e => GetEndpointName(e))
-                .Where(g => g.Key != null)
-                .Where(g => g.Count() > 1);
+                .Where(g => g.Key != null && g.Count() > 1);
 
 
             var builder = new StringBuilder();
             var builder = new StringBuilder();
             builder.AppendLine(Resources.DuplicateEndpointNameHeader);
             builder.AppendLine(Resources.DuplicateEndpointNameHeader);