Skip to content

Commit fabffc1

Browse files
Update changelogs from fern repo (#3323)
Co-authored-by: Swimburger <3382717+Swimburger@users.noreply.github.com>
1 parent 4db572d commit fabffc1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

fern/products/sdks/overview/csharp/changelog/2026-01-27.mdx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
## 2.19.0
2+
**`(feat):`** Add support for type-safe undiscriminated unions with the new `use-undiscriminated-unions` configuration option.
3+
4+
Undiscriminated unions provide a clean, type-safe way to work with values that can be one of several types:
5+
6+
```csharp
7+
// Creating union values
8+
var response = MyUnion.FromString("hello");
9+
var response = MyUnion.FromInt(42);
10+
var response = MyUnion.FromCustomObject(new CustomObject { ... });
11+
12+
// Type-safe value access with Is* properties and As* methods
13+
if (response.IsString)
14+
{
15+
string value = response.AsString();
16+
Console.WriteLine($"Got string: {value}");
17+
}
18+
else if (response.IsInt)
19+
{
20+
int value = response.AsInt();
21+
Console.WriteLine($"Got integer: {value}");
22+
}
23+
24+
// Safe extraction with TryAs* pattern (no exceptions)
25+
if (response.TryAsCustomObject(out var obj))
26+
{
27+
Console.WriteLine($"Got object: {obj.Name}");
28+
}
29+
```
30+
31+
This provides better IntelliSense support and compile-time safety compared to working with generic `object` types.
32+
33+
34+
**`(chore):`** Reduce NuGet package dependencies. The OneOf library is no longer required when undiscriminated unions are not used,
35+
resulting in smaller package sizes and fewer transitive dependencies.
36+
37+
138
## 2.18.1
239
**`(fix):`** While most `<`s and `>`s should be escaped to `&lt;` and `&gt;` to avoid mangling the output,
340
genuine XML/HTML tags should be kept as-is; this commit scans for potential valid tags and

0 commit comments

Comments
 (0)