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:

1// Creating union values
2var response = MyUnion.FromString("hello");
3var response = MyUnion.FromInt(42);
4var response = MyUnion.FromCustomObject(new CustomObject { ... });
5
6// Type-safe value access with Is* properties and As* methods
7if (response.IsString)
8{
9 string value = response.AsString();
10 Console.WriteLine($"Got string: {value}");
11}
12else if (response.IsInt)
13{
14 int value = response.AsInt();
15 Console.WriteLine($"Got integer: {value}");
16}
17
18// Safe extraction with TryAs* pattern (no exceptions)
19if (response.TryAsCustomObject(out var obj))
20{
21 Console.WriteLine($"Got object: {obj.Name}");
22}

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 &lt; and &gt; to avoid mangling the output, genuine XML/HTML tags should be kept as-is; this commit scans for potential valid tags and prevents their being escaped. (Ambiguous cases are escaped.)

Before:

/// XMLDoc (C#) (Example of actual XML tags):
/// See &lt;a href="https://example.com/docs"&gt;the docs&lt;/a&gt; for more info.
/// Use &lt;code&gt;getValue()&lt;/code&gt; to retrieve the value.
/// Note: when count &lt; 10 or count &gt; 100, special handling applies.

After:

/// XMLDoc (C#) (Example of actual XML tags):
/// See <a href="https://example.com/docs">the docs</a> for more info.
/// Use <code>getValue()</code> to retrieve the value.
/// Note: when count &lt; 10 or count &gt; 100, special handling applies.