dotnet / dotnet/aspnetcore

Support Results<T> with a single type argument

Open
#66,857 3 comments 2 reactions 0 assignees View on GitHub
api-proposal api-suggestion area-minimal
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

## Summary

`Results` currently requires 2–6 type arguments. A single-type-argument `Results` is not supported.

## Motivation

C# 15 allows union types with a single type for consistency and composability. For the same reasons, `Results` should be supported in ASP.NET Core.

While `Results` is semantically equivalent to just using `T` directly, supporting it improves consistency with the language's type system and enables scenarios where code-generation or generic composition produces a single-variant union.

## Proposed Change

Add a `Results` class (single type argument) alongside the existing `Results` through `Results` variants in `src/Http/Http.Results/src/ResultsOfT.Generated.cs`.

This could be done by updating the generator at `src/Http/Http.Results/tools/ResultsOfTGenerator/Program.cs` to start at 1 type argument instead of 2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.