# Use C# unions and closed hierarchies in ASP.NET Core

DevFeed: [Use C# unions and closed hierarchies in ASP.NET Core](<https://devfeed.tech/articles/use-c-unions-and-closed-hierarchies-in-asp-net-core-2954.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/dotnet/unions-and-closed-hierarchies-in-aspnetcore/>)

Author: Dmitrii Korolev

Published: 2026-09-10T17:00:00Z

Content type: tutorial

Language: en

Sources: [.NET Blog](<https://devfeed.tech/sources/net-blog.md>)

Topics: [C# 15](<https://devfeed.tech/topics/c-sharp-15.md>), [ASP.NET Core](<https://devfeed.tech/topics/asp-net-core.md>), [.NET](<https://devfeed.tech/topics/net.md>), [Polymorphism](<https://devfeed.tech/topics/polymorphism.md>)

Tags: [asp-net-core](<https://devfeed.tech/tags/asp-net-core.md>), [blazor](<https://devfeed.tech/tags/blazor.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [c-sharp-15](<https://devfeed.tech/tags/c-sharp-15.md>), [closed-hierarchies](<https://devfeed.tech/tags/closed-hierarchies.md>), [json](<https://devfeed.tech/tags/json.md>), [minimal-api](<https://devfeed.tech/tags/minimal-api.md>), [mvc](<https://devfeed.tech/tags/mvc.md>), [net](<https://devfeed.tech/tags/net.md>), [net-11](<https://devfeed.tech/tags/net-11.md>), [openapi](<https://devfeed.tech/tags/openapi.md>), [polymorphism](<https://devfeed.tech/tags/polymorphism.md>), [signalr](<https://devfeed.tech/tags/signalr.md>), [system-text-json](<https://devfeed.tech/tags/system-text-json.md>), [union-types](<https://devfeed.tech/tags/union-types.md>)

## AI overview

Explains how C# unions and closed hierarchies model API values with a fixed set of possible types in ASP.NET Core. It contrasts unions with open inheritance-based polymorphism and describes System.Text.Json support.

## Source excerpt

Learn how C# unions and closed hierarchies work with System.Text.Json across ASP.NET Core Minimal APIs, MVC, SignalR, Blazor, and OpenAPI. The post Use C# unions and closed hierarchies in ASP.NET Core appeared first on .NET Blog.