<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by tech-genius on Medium]]></title>
        <description><![CDATA[Stories by tech-genius on Medium]]></description>
        <link>https://medium.com/@tech-genius?source=rss-fcf818296d60------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*U-QMUsGpY399kBuCbHsuYw.png</url>
            <title>Stories by tech-genius on Medium</title>
            <link>https://medium.com/@tech-genius?source=rss-fcf818296d60------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 04:08:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tech-genius/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[What’s New in .NET 11 and C# 15: Complete Guide With Code]]></title>
            <link>https://medium.com/@tech-genius/whats-new-in-net-11-and-c-15-complete-guide-with-code-f344c0d5c8a2?source=rss-fcf818296d60------2</link>
            <guid isPermaLink="false">https://medium.com/p/f344c0d5c8a2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[query-optimization]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[application]]></category>
            <dc:creator><![CDATA[tech-genius]]></dc:creator>
            <pubDate>Wed, 14 Oct 2026 10:58:48 GMT</pubDate>
            <atom:updated>2026-10-14T10:58:48.452Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*MLkOVgKeh8qdaysi.png" /></figure><p>Union types, closed hierarchies, Runtime Async, Blazor, EF Core 11 and every other change worth knowing, plus why reading the docs beats asking a chatbot.</p><blockquote><a href="https://medium.com/the-code-frontier/whats-new-in-net-11-and-c-15-complete-guide-with-code-02c271a014db">Orginally hosted at here</a></blockquote><p>Every November a new version of .NET ships. Some developers skim a headline list. Others ask a chatbot to explain it. A few months later, both groups are often writing last year’s code on this year’s framework.</p><blockquote><a href="https://medium.com/the-code-frontier/whats-new-in-net-11-and-c-15-complete-guide-with-code-02c271a014db?sk=c2d371309973d551ed7f5f1ff60ae10f"><em>Read here for free</em></a></blockquote><p>This article is my attempt to do it properly. It covers what is new in .NET 11 and C# 15, with code you can run, and a plain argument for learning it yourself instead of outsourcing your understanding.</p><p>A quick status check first. The docs say .NET 11 is in release candidate, with general availability expected in November 2026. It is a Standard Term Support release, supported for two years after it goes stable. C# 15 is the default language version for projects that target .NET 11. A few features are still marked preview or experimental, and I will flag each one.</p><h3>Why you should learn this version yourself</h3><p>I use AI tools every day, so this is not an anti AI rant. But this release shows exactly where leaning on them fully goes wrong.</p><p><strong>The ground is still moving:</strong> Look at the memory safety work in C# 15. Microsoft says its model and syntax might change for .NET 12 and C# 16. The docs also admit that some features from the union types specification are not implemented yet. A model trained before those changes cannot know what changed. Only the current docs can.</p><p><strong>Lists get copied and corrupted:</strong> While researching this article I found posts that list features under C# 15 that are not on the official list. Primary constructors, for example, arrived in C# 12. If you repeat a wrong claim in a code review or an interview, that is on you, not on the tool.</p><p><strong>You own the breaking changes:</strong> .NET 11 changes decimal conversion results, raises the minimum CPU requirements, and makes OpenAPI 3.2 the default. Nobody else is paged when those break production. You are.</p><p><strong>Design choices need judgment:</strong> Should this be a union, a closed hierarchy, or a plain interface? Even developers commenting on the official .NET blog disagree. One argued that C# is spending its complexity budget too freely. Another replied that compile time exhaustiveness errors beat runtime surprises. You cannot delegate that debate.</p><p><strong>You cannot review what you do not understand:</strong> This matters most for the new unsafe model. If a tool writes pointer code for you, you must be able to judge whether it is correct.</p><p>My rule is simple. Let AI draft. Never let it be the only reader of the docs. Now let’s get into the release.</p><h3>Setting up</h3><p>Install the .NET 11 SDK and target the new framework:</p><pre>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;<br>  &lt;PropertyGroup&gt;<br>    &lt;OutputType&gt;Exe&lt;/OutputType&gt;<br>    &lt;TargetFramework&gt;net11.0&lt;/TargetFramework&gt;<br>    &lt;Nullable&gt;enable&lt;/Nullable&gt;<br>  &lt;/PropertyGroup&gt;<br>&lt;/Project&gt;</pre><p>That is enough for C# 15. Preview features need extra switches, and I will show them where they apply.</p><h3>Part 1: C# 15</h3><p>C# 15 adds union types, closed hierarchies, the first preview of an updated unsafe model, collection expression arguments, extension indexers, and labeled break and continue. Let me take them one at a time.</p><h3>1. Union types</h3><p>A union type says, in the type system, exactly which types a value may hold. The case types do not need to share a base class.</p><pre>public record class Success(int OrderId);<br>public record class OutOfStock(string Sku);<br>public record class PaymentDeclined(string Reason);</pre><pre>public union OrderResult(Success, OutOfStock, PaymentDeclined);<br>static OrderResult Place(string sku, int quantity)<br>{<br>    if (quantity &gt; 5)<br>        return new OutOfStock(sku);<br>    return new Success(1042);<br>}<br>string message = Place(&quot;KB101&quot;, 2) switch<br>{<br>    Success s =&gt; $&quot;Order {s.OrderId} placed&quot;,<br>    OutOfStock o =&gt; $&quot;{o.Sku} is out of stock&quot;,<br>    PaymentDeclined p =&gt; p.Reason,<br>};</pre><p>Each case type converts implicitly to the union. Because the compiler knows the complete set, the switch expression over a non null union is exhaustive without a default arm.</p><p>The payoff arrives next year. When someone adds a fourth case, every switch that forgot it produces a compiler diagnostic instead of a runtime crash in production.</p><p>The ecosystem is already wired for this. System.Text.Json can serialize and deserialize union types, and it writes whichever case is active. ASP.NET Core supports unions anywhere System.Text.Json is used, including Minimal API bodies, SignalR’s JSON protocol and Blazor interop.</p><pre>public union UnionIntString(int, string);<br>app.MapGet(&quot;/value&quot;, () =&gt; new UnionIntString(42));</pre><p>Two limits to remember. Unions are not supported for route values, query strings, headers or form fields, and SignalR unions need the JSON hub protocol. Also, .NET 11 ships UnionAttribute and IUnion as the runtime side of the design, mainly meant to be produced by the compiler and source generators.</p><h3>2. Closed hierarchies</h3><p>Unions cover unrelated types. Closed hierarchies cover the classic inheritance case. A closed class can only be derived from inside its declaring assembly, which fixes the set of direct descendants at compile time.</p><pre>public closed record class JobStatus;<br>public record class Queued : JobStatus;<br>public record class Running(int PercentComplete) : JobStatus;<br>public record class Completed(TimeSpan Elapsed) : JobStatus;<br>public record class Failed(string Error) : JobStatus;<br><br>string Describe(JobStatus status) =&gt; status switch<br>{<br>    Queued =&gt; &quot;Waiting in line&quot;,<br>    Running(var percent) =&gt; $&quot;{percent}% done&quot;,<br>    Completed(var elapsed) =&gt; $&quot;Finished in {elapsed.TotalSeconds:F1}s&quot;,<br>    Failed(var error) =&gt; $&quot;Failed: {error}&quot;,<br>};</pre><p>A closed class is implicitly abstract and cannot be combined with sealed, static or an explicit abstract. Watch one subtle rule. Derivation is not transitive, so a descendant that is not itself closed can still be derived from in other assemblies. If you want exhaustiveness further down, mark the intermediate types closed too.</p><h3>Read complete article at here:</h3><blockquote><a href="https://medium.com/the-code-frontier/whats-new-in-net-11-and-c-15-complete-guide-with-code-02c271a014db">Orginally hosted at here</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f344c0d5c8a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>