Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 1.02 KB

File metadata and controls

25 lines (18 loc) · 1.02 KB

C# in .NET 11 Preview 3 - Release Notes

C# in Preview 3 includes an update for union types:

union type support

Compiler support for union types was added in preview 2. Preview 3 includes better IDE support for working with union types. You can read the details in our blog post on union types, and in the C# Guide. The What's new page provides links to the language reference, and will include links to tutorials and more in the near future.

Note that in preview 3, you need to provide polyfills for the UnionAttribute type and the IUnion interface:

namespace System.Runtime.CompilerServices
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct,
        AllowMultiple = false)]
    public sealed class UnionAttribute : Attribute;

    public interface IUnion
    {
        object? Value { get; }
    }
}