From 6f9a15599f7cbf9b9053d64e8ce1aba70f8e5bd7 Mon Sep 17 00:00:00 2001 From: Swimburger <3382717+Swimburger@users.noreply.github.com> Date: Wed, 28 Jan 2026 04:20:07 +0000 Subject: [PATCH] update changelogs --- .../overview/csharp/changelog/2026-01-27.mdx | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/fern/products/sdks/overview/csharp/changelog/2026-01-27.mdx b/fern/products/sdks/overview/csharp/changelog/2026-01-27.mdx index 35155534c..6465e534a 100644 --- a/fern/products/sdks/overview/csharp/changelog/2026-01-27.mdx +++ b/fern/products/sdks/overview/csharp/changelog/2026-01-27.mdx @@ -1,3 +1,40 @@ +## 2.19.0 +**`(feat):`** Add support for type-safe undiscriminated unions with the new `use-undiscriminated-unions` configuration option. + +Undiscriminated unions provide a clean, type-safe way to work with values that can be one of several types: + +```csharp +// Creating union values +var response = MyUnion.FromString("hello"); +var response = MyUnion.FromInt(42); +var response = MyUnion.FromCustomObject(new CustomObject { ... }); + +// Type-safe value access with Is* properties and As* methods +if (response.IsString) +{ + string value = response.AsString(); + Console.WriteLine($"Got string: {value}"); +} +else if (response.IsInt) +{ + int value = response.AsInt(); + Console.WriteLine($"Got integer: {value}"); +} + +// Safe extraction with TryAs* pattern (no exceptions) +if (response.TryAsCustomObject(out var obj)) +{ + Console.WriteLine($"Got object: {obj.Name}"); +} +``` + +This provides better IntelliSense support and compile-time safety compared to working with generic `object` types. + + +**`(chore):`** Reduce NuGet package dependencies. The OneOf library is no longer required when undiscriminated unions are not used, +resulting in smaller package sizes and fewer transitive dependencies. + + ## 2.18.1 **`(fix):`** While most `<`s and `>`s should be escaped to `<` and `>` to avoid mangling the output, genuine XML/HTML tags should be kept as-is; this commit scans for potential valid tags and