TRENDING

TECHNOLOGY NEWS FROM AROUND THE WORLD

→
C# 15 union types: modeling order outcomes without contradictory states
Software Engineering · 2026Photo: Unsplash / Unsplash ↗
Software Engineering

C# 15 union types: modeling order outcomes without contradictory states

An order-result example examines C# 15 union types announced with .NET 11, distinguishing compiler-visible alternatives from the API's external contract.

Developer's JournalPublished: Nov 18, 20264 min read
Reading progress0%

Reviewing the 10 November release today

.NET 11 was released on 10 November 2026, with C# 15 union types and closed hierarchies among its announced capabilities. This original analysis is dated 18 November. Unlike a general API modernization article, it focuses on modeling the result of an order lookup. The example is hypothetical, not a reported migration or reduction in defects. A language feature can express a domain model, but cannot decide its business meaning.

What independent flags can conceal

Imagine a result carrying separate found, failed and pending flags. If those values can vary independently, contradictory combinations become possible and consumers must decide which one to trust. First describe meaningful alternatives such as a found order, an absent order and an incomplete lookup. Specify the data each requires. The goal is not more classes everywhere, but a clear representation of genuinely different business outcomes.

Machine learning pipelineConceptual sketch · summary of the article's technical flow

Distinguish absence from technical failure

An order not being found is not necessarily a technical error. Equally, an unreachable data source does not prove the order is absent. This distinction affects messages and retry decisions. A missing order may call for corrected search information, while temporary unavailability may justify another attempt. The model exposes those choices without making them automatically. Consider whether disclosing the existence of a sensitive record fits the authorization policy.

The internal type is not the wire contract

Compiler-visible alternatives do not automatically become an equivalent JSON contract. OpenAPI's schema composition provides a technical reference for documenting that boundary. Define the result discriminator, required fields and treatment of new alternatives by older consumers. Do not assume a particular serializer output without checking the actual tools. A clean internal model and a meaningful external representation are related, but separately verifiable, design concerns.

Consider every consumer when adding a state

A new awaiting-review result may need different presentation in an administrative screen and a public interface. Compilation alone cannot assess that difference. Review the display, diagnostic record and external response for each alternative. Compiler checks also do not prove the correctness of incoming external data. A short change record can explain why the new state exists and which earlier expectations it changes.

Start with a bounded pilot

Choose a service whose results are well understood instead of converting the entire project immediately. Acceptance should prioritize understandable states over shorter code. Include contradictory legacy examples and decide deliberately how to translate them. Account for learning and tooling compatibility. The enduring benefit is independent of syntax: define the outcomes the business can actually produce, describe their data and communicate the same meaning reliably to consumers.

Be the first reader ✎ Write a comment

Comments

No comments yet. Be the first to contribute.

Write a comment

Your first and last name will appear publicly alongside your comment.

Sample comments and editor reply

Discussion example — not real reader feedback. Names and conversations in this area are fictional. Likes and replies here are not saved and do not count as real engagement.

Example counters: 6,424 reads · 344 likes — not actual analytics

Ayşe Yılmaz

Reading “C# 15 union types: modeling order outcomes without contradictory states” raised this question for me: compatibility and debugging impact deserve review.

Sample editor reply

Editor note: Product claims and measured outcomes should be assessed separately. A small pilot with defined metrics is a useful first step.

Fatma Demir

We should also discuss maintenance cost. An easy rollout does not guarantee trouble-free upgrades.

Mehmet Kaya

I would start with a pilot and measurable success criteria rather than assuming a launch means proven value.