Skip to content

Commit 000a803

Browse files
Apply code suggestions from Visual Studio (#34064)
Applies a number of Visual Studio suggestions and errors found while working on #34063.
1 parent 49042d1 commit 000a803

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/Http/Routing/src/ModelEndpointDataSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Routing
1212
{
1313
internal class ModelEndpointDataSource : EndpointDataSource
1414
{
15-
private List<DefaultEndpointConventionBuilder> _endpointConventionBuilders;
15+
private readonly List<DefaultEndpointConventionBuilder> _endpointConventionBuilders;
1616

1717
public ModelEndpointDataSource()
1818
{

src/Mvc/Mvc.ApiExplorer/src/DefaultApiDescriptionProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ private ApiParameterRouteInfo CreateRouteInfo(TemplatePart routeParameter)
338338
};
339339
}
340340

341-
private IEnumerable<string?> GetHttpMethods(ControllerActionDescriptor action)
341+
private static IEnumerable<string?> GetHttpMethods(ControllerActionDescriptor action)
342342
{
343343
if (action.ActionConstraints != null && action.ActionConstraints.Count > 0)
344344
{
@@ -350,7 +350,7 @@ private ApiParameterRouteInfo CreateRouteInfo(TemplatePart routeParameter)
350350
}
351351
}
352352

353-
private RouteTemplate? ParseTemplate(ControllerActionDescriptor action)
353+
private static RouteTemplate? ParseTemplate(ControllerActionDescriptor action)
354354
{
355355
if (action.AttributeRouteInfo?.Template != null)
356356
{
@@ -445,7 +445,7 @@ internal static MediaTypeCollection GetDeclaredContentTypes(IReadOnlyList<IApiRe
445445
return contentTypes;
446446
}
447447

448-
private IApiRequestMetadataProvider[]? GetRequestMetadataAttributes(ControllerActionDescriptor action)
448+
private static IApiRequestMetadataProvider[]? GetRequestMetadataAttributes(ControllerActionDescriptor action)
449449
{
450450
if (action.FilterDescriptors == null)
451451
{

src/Mvc/Mvc.ApiExplorer/src/EndpointMetadataApiDescriptionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private static ApiResponseType CreateDefaultApiResponseType(Type responseType)
322322
}
323323

324324
private static EndpointModelMetadata CreateModelMetadata(Type type) =>
325-
new EndpointModelMetadata(ModelMetadataIdentity.ForType(type));
325+
new(ModelMetadataIdentity.ForType(type));
326326

327327
private static void AddResponseContentTypes(IList<ApiResponseFormat> apiResponseFormats, IReadOnlyList<string> contentTypes)
328328
{

src/Mvc/Mvc.Core/src/Routing/ActionEndpointFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private static (RoutePattern resolvedRoutePattern, IDictionary<string, string?>
304304
return (attributeRoutePattern, resolvedRequiredValues ?? action.RouteValues);
305305
}
306306

307-
private void AddActionDataToBuilder(
307+
private static void AddActionDataToBuilder(
308308
EndpointBuilder builder,
309309
HashSet<string> routeNames,
310310
ActionDescriptor action,

0 commit comments

Comments
 (0)