Skip to content

Commit eb982dd

Browse files
Copilotmeaghanlewiswadepickett
authored
Freshness review: Controller action return types in ASP.NET Core web API (#36811)
* Initial plan * Freshness review: fix metadata, double spaces, and internal links in action-return-types articles Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Wade Pickett <wpickett@microsoft.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> Co-authored-by: Meaghan Osagie (Lewis) <mosagie@microsoft.com> Co-authored-by: Wade Pickett <wpickett@microsoft.com>
1 parent a56e782 commit eb982dd

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

aspnetcore/web-api/action-return-types.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
title: Controller action return types in ASP.NET Core web API
3+
ai-usage: ai-assisted
34
author: tdykstra
45
description: ActionResult vs IActionResult
56
monikerRange: '>= aspnetcore-3.1'
67
ms.author: tdykstra
78
ms.custom: mvc
8-
ms.date: 6/20/2023
9+
ms.date: 02/26/2026
910
uid: web-api/action-return-types
1011
---
1112
# Controller action return types in ASP.NET Core web API
@@ -37,7 +38,7 @@ When multiple return types are possible, it's common to mix an <xref:Microsoft.A
3738

3839
### Return IEnumerable\<T> or IAsyncEnumerable\<T>
3940

40-
See [Return `IEnumerable<T>` or `IAsyncEnumerable<T>`](/aspnet/core/fundamentals/best-practices#return-ienumerablet-or-iasyncenumerablet) for performance considerations.
41+
See [Return `IEnumerable<T>` or `IAsyncEnumerable<T>`](xref:fundamentals/best-practices#return-ienumerablet-or-iasyncenumerablet) for performance considerations.
4142

4243
ASP.NET Core buffers the result of actions that return <xref:System.Collections.Generic.IEnumerable%601> before writing them to the response. Consider declaring the action signature's return type as <xref:System.Collections.Generic.IAsyncEnumerable%601> to guarantee asynchronous iteration. Ultimately, the iteration mode is based on the underlying concrete type being returned and the selected formatter affects how the result is processed:
4344

@@ -97,7 +98,7 @@ If the [`[ApiController]`](xref:Microsoft.AspNetCore.Mvc.ApiControllerAttribute)
9798

9899
## ActionResult vs IActionResult
99100

100-
The following section compares `ActionResult` to `IActionResult`
101+
The following section compares `ActionResult` to `IActionResult`.
101102

102103
### ActionResult\<T> type
103104

@@ -144,12 +145,12 @@ In the preceding action:
144145

145146
## HttpResults type
146147

147-
In addition to the MVC-specific built-in result types (<xref:Microsoft.AspNetCore.Mvc.IActionResult> and [ActionResult\<T>](xref:Microsoft.AspNetCore.Mvc.ActionResult%601)), ASP.NET Core includes the [HttpResults](xref:Microsoft.AspNetCore.Http.HttpResults) types that can be used in both [Minimal APIs](/aspnet/core/fundamentals/minimal-apis) and Web API.
148+
In addition to the MVC-specific built-in result types (<xref:Microsoft.AspNetCore.Mvc.IActionResult> and [ActionResult\<T>](xref:Microsoft.AspNetCore.Mvc.ActionResult%601)), ASP.NET Core includes the [HttpResults](xref:Microsoft.AspNetCore.Http.HttpResults) types that can be used in both [Minimal APIs](xref:fundamentals/minimal-apis) and Web API.
148149

149150
Different than the MVC-specific result types, the `HttpResults`:
150151

151152
* Are a results implementation that is processed by a call to [IResult.ExecuteAsync](xref:Microsoft.AspNetCore.Http.IResult.ExecuteAsync%2A).
152-
* Does ***not*** leverage the configured [Formatters](/aspnet/core/web-api/advanced/formatting#format-specific-action-results). Not leveraging the configured formatters means:
153+
* Does ***not*** leverage the configured [Formatters](xref:web-api/advanced/formatting#format-specific-action-results). Not leveraging the configured formatters means:
153154

154155
* Some features like `Content negotiation` aren't available.
155156
* The produced `Content-Type` is decided by the `HttpResults` implementation.
@@ -160,7 +161,7 @@ The `HttpResults` can be useful when sharing code between Minimal APIs and Web A
160161

161162
The <xref:Microsoft.AspNetCore.Http.HttpResults> namespace contains classes that implement the <xref:Microsoft.AspNetCore.Http.IResult> interface. The `IResult` interface defines a contract that represents the result of an HTTP endpoint. The static [Results](<xref:Microsoft.AspNetCore.Http.Results>) class is used to create varying `IResult` objects that represent different types of responses.
162163

163-
The [Built-in results](/aspnet/core/fundamentals/minimal-apis#built-in-results) table shows the common result helpers.
164+
The [Built-in results](xref:fundamentals/minimal-apis#built-in-results) table shows the common result helpers.
164165

165166
Consider the following code:
166167

aspnetcore/web-api/action-return-types/includes/action-return-types7.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ When multiple return types are possible, it's common to mix an <xref:Microsoft.A
2424

2525
### Return IEnumerable\<T> or IAsyncEnumerable\<T>
2626

27-
See [Return `IEnumerable<T>` or `IAsyncEnumerable<T>`](/aspnet/core/fundamentals/best-practices#return-ienumerablet-or-iasyncenumerablet) for performance considerations.
27+
See [Return `IEnumerable<T>` or `IAsyncEnumerable<T>`](xref:fundamentals/best-practices#return-ienumerablet-or-iasyncenumerablet) for performance considerations.
2828

2929
ASP.NET Core buffers the result of actions that return <xref:System.Collections.Generic.IEnumerable%601> before writing them to the response. Consider declaring the action signature's return type as <xref:System.Collections.Generic.IAsyncEnumerable%601> to guarantee asynchronous iteration. Ultimately, the iteration mode is based on the underlying concrete type being returned and the selected formatter affects how the result is processed:
3030

@@ -84,7 +84,7 @@ If the [`[ApiController]`](xref:Microsoft.AspNetCore.Mvc.ApiControllerAttribute)
8484

8585
## ActionResult vs IActionResult
8686

87-
The following section compares `ActionResult` to `IActionResult`
87+
The following section compares `ActionResult` to `IActionResult`.
8888

8989
### ActionResult\<T> type
9090

@@ -131,12 +131,12 @@ In the preceding action:
131131

132132
## HttpResults type
133133

134-
In addition to the MVC-specific built-in result types (<xref:Microsoft.AspNetCore.Mvc.IActionResult> and [ActionResult\<T>](xref:Microsoft.AspNetCore.Mvc.ActionResult%601)), ASP.NET Core includes the [HttpResults](xref:Microsoft.AspNetCore.Http.HttpResults) types that can be used in both [Minimal APIs](/aspnet/core/fundamentals/minimal-apis) and Web API.
134+
In addition to the MVC-specific built-in result types (<xref:Microsoft.AspNetCore.Mvc.IActionResult> and [ActionResult\<T>](xref:Microsoft.AspNetCore.Mvc.ActionResult%601)), ASP.NET Core includes the [HttpResults](xref:Microsoft.AspNetCore.Http.HttpResults) types that can be used in both [Minimal APIs](xref:fundamentals/minimal-apis) and Web API.
135135

136136
Different than the MVC-specific result types, the `HttpResults`:
137137

138138
* Are a results implementation that is processed by a call to [IResult.ExecuteAsync](xref:Microsoft.AspNetCore.Http.IResult.ExecuteAsync%2A).
139-
* Does ***not*** leverage the configured [Formatters](/aspnet/core/web-api/advanced/formatting#format-specific-action-results). Not leveraging the configured formatters means:
139+
* Does ***not*** leverage the configured [Formatters](xref:web-api/advanced/formatting#format-specific-action-results). Not leveraging the configured formatters means:
140140

141141
* Some features like `Content negotiation` aren't available.
142142
* The produced `Content-Type` is decided by the `HttpResults` implementation.
@@ -275,7 +275,7 @@ If the [`[ApiController]`](xref:Microsoft.AspNetCore.Mvc.ApiControllerAttribute)
275275

276276
## ActionResult vs IActionResult
277277

278-
The following section compares `ActionResult` to `IActionResult`
278+
The following section compares `ActionResult` to `IActionResult`.
279279

280280
### ActionResult\<T> type
281281

0 commit comments

Comments
 (0)