Emik.SourceGenerators.Choices 1.3.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Emik.SourceGenerators.Choices --version 1.3.3                
NuGet\Install-Package Emik.SourceGenerators.Choices -Version 1.3.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Emik.SourceGenerators.Choices" Version="1.3.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Emik.SourceGenerators.Choices --version 1.3.3                
#r "nuget: Emik.SourceGenerators.Choices, 1.3.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Emik.SourceGenerators.Choices as a Cake Addin
#addin nuget:?package=Emik.SourceGenerators.Choices&version=1.3.3

// Install Emik.SourceGenerators.Choices as a Cake Tool
#tool nuget:?package=Emik.SourceGenerators.Choices&version=1.3.3                

Emik.Analyzers.Choices

NuGet package License

Annotate [Choice] to transform your type into a highly performant and flexible disjoint union.

Massive thanks to hikarin522's ValueVariant for being the inspiration to this source generator.

This project has a dependency to Emik.Morsels, if you are building this project, refer to its README first.



Examples

// Example 1
[Choice]
readonly partial record struct Result<TOk, TErr>
{
    readonly TOk? _ok;

    readonly TErr? _err;
}
Example 1's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/>
///         is an immutable disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factory
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Ok"/> <see langword="as"/> <typeparamref name="TOk"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsOk"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <see cref="OfOk(TOk)"/>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Err"/> <see langword="as"/> <typeparamref name="TErr"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsErr"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <see cref="OfErr(TErr)"/>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Auto)]
partial record struct Result<TOk, TErr> :
    global::System.IComparable,
    global::System.IComparable<object>,
    global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr>>,
#if NET7_0_OR_GREATER
    global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr>, global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr>, bool>,
#endif
    global::System.IEquatable<object>,
    global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr>>
{
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private readonly byte _discriminator;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Ok"/> of type <typeparamref name="TOk"/>.
    /// </summary>
    /// <param name="ok">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Result(TOk? ok)
    {
        _discriminator = 0;
        _ok = ok;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Err"/> of type <typeparamref name="TErr"/>.
    /// </summary>
    /// <param name="err">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Result(TErr? err)
    {
        _discriminator = 1;
        _err = err;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> is the variant <see cref="Ok"/> of type <typeparamref name="TOk"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsOk
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Ok")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Err")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> is the variant <see cref="Err"/> of type <typeparamref name="TErr"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsErr
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Err")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Ok")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1;
    }

    /// <summary>
    /// Gets the <typeparamref name="TOk"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly TOk? Ok
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0 ? _ok : default;
    }

    /// <summary>
    /// Gets the <typeparamref name="TErr"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly TErr? Err
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1 ? _err : default;
    }

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Ok"/> of type <typeparamref name="TOk"/>.
    /// </summary>
    /// <param name="ok">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="ok"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> OfOk(TOk? ok)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr>(ok);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Err"/> of type <typeparamref name="TErr"/>.
    /// </summary>
    /// <param name="err">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="err"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> OfErr(TErr? err)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr>(err);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> left, Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> left, Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> left, Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> left, Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> right)
        => right >= left;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(object? obj)
        => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> x ? CompareTo(x) : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> other)
        => Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override int GetHashCode()
        => unchecked(_discriminator * 673447) ^
        (_discriminator switch
        {
            0 => Ok!.GetHashCode(),
            1 => Err!.GetHashCode(),
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override string ToString()
        => _discriminator switch
        {
            0 => $"{nameof(Ok)}({Ok})",
            1 => $"{nameof(Err)}({Err})",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onOk">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Ok"/> of type <typeparamref name="TOk"/> is held.</param>
    /// <param name="onErr">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Err"/> of type <typeparamref name="TErr"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly Emik.SourceGenerators.Choices.Generated.Tests.Result<TOk, TErr> Map(
        global::System.Action<TOk?>? onOk = null,
        global::System.Action<TErr?>? onErr = null
    )
    {
        switch (_discriminator)
        {
            case 0:
                onOk?.Invoke(Ok!);
                return this;
            case 1:
                onErr?.Invoke(Err!);
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onOk">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Ok"/> of type <typeparamref name="TOk"/> is held.</param>
    /// <param name="onErr">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Result{TOk, TErr}"/> record struct with the variant <see cref="Err"/> of type <typeparamref name="TErr"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly TMappingResult Map<TMappingResult>(
        global::System.Func<TOk?, TMappingResult> onOk,
        global::System.Func<TErr?, TMappingResult> onErr
    )
        => _discriminator
        switch
        {
            0 => onOk(Ok!),
            1 => onErr(Err!),
            _ => throw new global::System.InvalidOperationException(),
        };
}

// Example 2
[Choice(true)]
ref partial struct SpanEncodings
{
    Span<byte> _utf8;

    Span<char> _utf16;
}
Example 2's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/>
///         is a mutable disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factories
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Utf8"/> <see langword="as"/> <see cref="System.Span{T}"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsUtf8"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfUtf8(System.Span{byte})"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(System.Span{byte})"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Span{byte})"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Utf16"/> <see langword="as"/> <see cref="System.Span{T}"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsUtf16"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfUtf16(System.Span{char})"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(System.Span{char})"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Span{char})"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Auto)]
partial struct SpanEncodings
{
    /// <summary>
    /// Explicit side effect delegate for the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/> due to it being a by-ref like type.
    /// </summary>
    /// <param name="utf8">The referenced value.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public delegate void Utf8Handler(System.Span<byte> utf8);

    /// <summary>
    /// Explicit mapper delegate for the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/> due to it being a by-ref like type.
    /// </summary>
    /// <typeparam name="TMappingResult">The type of value to return.</typeparam>
    /// <param name="utf8">The referenced value.</param>
    /// <returns>The result of the mapping.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public delegate TMappingResult Utf8Handler<out TMappingResult>(System.Span<byte> utf8);

    /// <summary>
    /// Explicit side effect delegate for the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/> due to it being a by-ref like type.
    /// </summary>
    /// <param name="utf16">The referenced value.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public delegate void Utf16Handler(System.Span<char> utf16);

    /// <summary>
    /// Explicit mapper delegate for the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/> due to it being a by-ref like type.
    /// </summary>
    /// <typeparam name="TMappingResult">The type of value to return.</typeparam>
    /// <param name="utf16">The referenced value.</param>
    /// <returns>The result of the mapping.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public delegate TMappingResult Utf16Handler<out TMappingResult>(System.Span<char> utf16);

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private byte _discriminator;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/>.
    /// </summary>
    /// <param name="utf8">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public SpanEncodings(System.Span<byte> utf8)
    {
        _discriminator = 0;
        _utf8 = utf8;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/>.
    /// </summary>
    /// <param name="utf16">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public SpanEncodings(System.Span<char> utf16)
    {
        _discriminator = 1;
        _utf16 = utf16;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> is the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsUtf8
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Utf8")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Utf16")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> is the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsUtf16
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Utf16")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Utf8")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1;
    }

    /// <summary>
    /// Gets or sets the <see cref="System.Span{T}"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Span<byte> Utf8
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        readonly get => _discriminator is 0 ? _utf8 : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        set
        {
            _discriminator = 0;
            _utf8 = value;
        }
    }

    /// <summary>
    /// Gets or sets the <see cref="System.Span{T}"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Span<char> Utf16
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        readonly get => _discriminator is 1 ? _utf16 : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        set
        {
            _discriminator = 1;
            _utf16 = value;
        }
    }

    /// <summary>
    /// Implicitly converts the <see cref="System.Span{T}"/> parameter to the union.
    /// </summary>
    /// <param name="utf8">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="utf8"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(System.Span<byte> utf8)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(utf8);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Span{T}"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Span<byte>(global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings x)
        => x.Utf8;

    /// <summary>
    /// Implicitly converts the <see cref="System.Span{T}"/> parameter to the union.
    /// </summary>
    /// <param name="utf16">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="utf16"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(System.Span<char> utf16)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(utf16);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Span{T}"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Span<char>(global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings x)
        => x.Utf16;

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/>.
    /// </summary>
    /// <param name="utf8">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="utf8"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings OfUtf8(System.Span<byte> utf8)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(utf8);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/>.
    /// </summary>
    /// <param name="utf16">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="utf16"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings OfUtf16(System.Span<char> utf16)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings(utf16);

    /// <summary>
    /// Determines whether the left-hand side is equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings left, Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });
    
    /// <summary>
    /// Determines whether the left-hand side is unequal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is unequal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings left, Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings right)
        => !(left == right);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings left, Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings left, Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings left, Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings left, Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings right)
        => right >= left;

    /// <inheritdoc cref="object.Equals(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override bool Equals(object? obj)
        => false;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(object? obj)
        => -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings other)
        => Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override int GetHashCode()
        => unchecked(_discriminator * 733879) ^
        (_discriminator switch
        {
            0 => Utf8.GetHashCode(),
            1 => Utf16.GetHashCode(),
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override string ToString()
        => _discriminator switch
        {
            0 => $"{nameof(Utf8)}({Utf8.ToString()})",
            1 => $"{nameof(Utf16)}({Utf16.ToString()})",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onUtf8">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/> is held.</param>
    /// <param name="onUtf16">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings Map(
        Utf8Handler? onUtf8 = null,
        Utf16Handler? onUtf16 = null
    )
    {
        switch (_discriminator)
        {
            case 0:
                onUtf8?.Invoke(Utf8);
                return this;
            case 1:
                onUtf16?.Invoke(Utf16);
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onUtf8">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf8"/> of type <see cref="System.Span{T}"/> is held.</param>
    /// <param name="onUtf16">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SpanEncodings"/> struct with the variant <see cref="Utf16"/> of type <see cref="System.Span{T}"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly TMappingResult Map<TMappingResult>(
        Utf8Handler<TMappingResult> onUtf8,
        Utf16Handler<TMappingResult> onUtf16
    )
        => _discriminator
        switch
        {
            0 => onUtf8(Utf8),
            1 => onUtf16(Utf16),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Span{T}.Clear()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly void Clear()
    {
        switch (_discriminator)
        {
            case 0:
                _utf8.Clear();
                break;
            case 1:
                _utf16.Clear();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Span{T}.IsEmpty"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsEmpty
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => _utf8.IsEmpty,
            1 => _utf16.IsEmpty,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Span{T}.Length"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly int Length
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => _utf8.Length,
            1 => _utf16.Length,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="object.GetType()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Type GetUnderlyingType()
        => _discriminator switch
        {
            0 => typeof(System.Span<byte>),
            1 => typeof(System.Span<char>),
            _ => throw new global::System.InvalidOperationException(),
        };
}

// Example 3
[Choice(typeof((int Integer, float Floating, ValueTuple Unknown)), false)]
partial class Number;
Example 3's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/>
///         is a disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factories
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Integer"/> <see langword="as"/> <see cref="int"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsInteger"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfInteger(int)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number(int)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(int)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Floating"/> <see langword="as"/> <see cref="float"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsFloating"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfFloating(float)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number(float)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(float)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 Unknown <see langword="as"/> <see cref="System.ValueTuple"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsUnknown"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfUnknown(System.ValueTuple)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number(System.ValueTuple)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.ValueTuple)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
partial class Number :
    global::System.IComparable,
    global::System.IComparable<object>,
    global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.Number>,
#if NET7_0_OR_GREATER
    global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.Number, global::Emik.SourceGenerators.Choices.Generated.Tests.Number, bool>,
#endif
    global::System.IEquatable<object>,
    global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.Number>
{
    /// <summary>
    /// Compact representation of all unmanaged memory within the union <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Explicit)]
    partial struct Unmanaged
    {
        [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
        internal int _integer;

        [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
        internal float _floating;
    }

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private byte _discriminator;

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private Unmanaged _unmanaged;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Integer"/> of type <see cref="int"/>.
    /// </summary>
    /// <param name="integer">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Number(int integer)
    {
        _discriminator = 0;
        _unmanaged._integer = integer;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Floating"/> of type <see cref="float"/>.
    /// </summary>
    /// <param name="floating">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Number(float floating)
    {
        _discriminator = 1;
        _unmanaged._floating = floating;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant Unknown of type <see cref="System.ValueTuple"/>.
    /// </summary>
    /// <param name="unknown">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Number(System.ValueTuple unknown = default)
    {
        _discriminator = 2;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> is the variant <see cref="Integer"/> of type <see cref="int"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsInteger
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Integer")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> is the variant <see cref="Floating"/> of type <see cref="float"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsFloating
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Floating")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> is the variant Unknown of type <see cref="System.ValueTuple"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsUnknown
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 2;
    }

    /// <summary>
    /// Gets the <see cref="int"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public int Integer
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0 ? _unmanaged._integer : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        private set
        {
            _discriminator = 0;
            _unmanaged._integer = value;
        }
    }

    /// <summary>
    /// Gets the <see cref="float"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public float Floating
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1 ? _unmanaged._floating : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        private set
        {
            _discriminator = 1;
            _unmanaged._floating = value;
        }
    }

    /// <summary>
    /// Implicitly converts the <see cref="int"/> parameter to the union.
    /// </summary>
    /// <param name="integer">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="integer"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Number(int integer)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Number(integer);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="int"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator int(global::Emik.SourceGenerators.Choices.Generated.Tests.Number x)
        => x.Integer;

    /// <summary>
    /// Implicitly converts the <see cref="float"/> parameter to the union.
    /// </summary>
    /// <param name="floating">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="floating"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Number(float floating)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Number(floating);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="float"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator float(global::Emik.SourceGenerators.Choices.Generated.Tests.Number x)
        => x.Floating;

    /// <summary>
    /// Implicitly converts the <see cref="System.ValueTuple"/> parameter to the union.
    /// </summary>
    /// <param name="unknown">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="unknown"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Number(System.ValueTuple unknown)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Number(unknown);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Integer"/> of type <see cref="int"/>.
    /// </summary>
    /// <param name="integer">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="integer"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Number OfInteger(int integer)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Number(integer);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Floating"/> of type <see cref="float"/>.
    /// </summary>
    /// <param name="floating">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="floating"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Number OfFloating(float floating)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Number(floating);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant Unknown of type <see cref="System.ValueTuple"/>.
    /// </summary>
    /// <param name="unknown">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="unknown"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Number OfUnknown(System.ValueTuple unknown = default)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Number(unknown);

    /// <summary>
    /// Determines whether the left-hand side is equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.Number? left, Emik.SourceGenerators.Choices.Generated.Tests.Number? right)
        => left is null ? right is null : right is not null && (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => left.Integer == right.Integer,
            1 => left.Floating == right.Floating,
            2 => true,
            _ => throw new global::System.InvalidOperationException(),
        });
    
    /// <summary>
    /// Determines whether the left-hand side is unequal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is unequal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.Number? left, Emik.SourceGenerators.Choices.Generated.Tests.Number? right)
        => !(left == right);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.Number? left, Emik.SourceGenerators.Choices.Generated.Tests.Number? right)
        => left is null ? right is null : right is not null && (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => left.Integer > right.Integer,
            1 => left.Floating > right.Floating,
            2 => true,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.Number? left, Emik.SourceGenerators.Choices.Generated.Tests.Number? right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.Number? left, Emik.SourceGenerators.Choices.Generated.Tests.Number? right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.Number? left, Emik.SourceGenerators.Choices.Generated.Tests.Number? right)
        => right >= left;

    /// <inheritdoc cref="object.Equals(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override bool Equals(object? obj)
        => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Number x && Equals(x);

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.Number? other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int CompareTo(object? obj)
        => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Number x ? CompareTo(x) : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.Number? other)
        => other is null ? 1 : Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override int GetHashCode()
        => unchecked(_discriminator * 578537) ^
        (_discriminator switch
        {
            0 => Integer.GetHashCode(),
            1 => Floating.GetHashCode(),
            2 => 0,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override string ToString()
        => _discriminator switch
        {
            0 => $"{nameof(Integer)}({Integer})",
            1 => $"{nameof(Floating)}({Floating})",
            2 => "Unknown",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onInteger">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Integer"/> of type <see cref="int"/> is held.</param>
    /// <param name="onFloating">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Floating"/> of type <see cref="float"/> is held.</param>
    /// <param name="onUnknown">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant Unknown of type <see cref="System.ValueTuple"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Emik.SourceGenerators.Choices.Generated.Tests.Number? Map(
        global::System.Action<int>? onInteger = null,
        global::System.Action<float>? onFloating = null,
        global::System.Action? onUnknown = null
    )
    {
        switch (_discriminator)
        {
            case 0:
                onInteger?.Invoke(Integer);
                return this;
            case 1:
                onFloating?.Invoke(Floating);
                return this;
            case 2:
                onUnknown?.Invoke();
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onInteger">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Integer"/> of type <see cref="int"/> is held.</param>
    /// <param name="onFloating">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant <see cref="Floating"/> of type <see cref="float"/> is held.</param>
    /// <param name="onUnknown">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Number"/> class with the variant Unknown of type <see cref="System.ValueTuple"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public TMappingResult Map<TMappingResult>(
        global::System.Func<int, TMappingResult> onInteger,
        global::System.Func<float, TMappingResult> onFloating,
        global::System.Func<TMappingResult> onUnknown
    )
        => _discriminator
        switch
        {
            0 => onInteger(Integer),
            1 => onFloating(Floating),
            2 => onUnknown(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="object.GetType()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Type GetUnderlyingType()
        => _discriminator switch
        {
            0 => typeof(int),
            1 => typeof(float),
            2 => typeof(System.ValueTuple),
            _ => throw new global::System.InvalidOperationException(),
        };
}

// Example 4
[Choice(typeof((AuditFlags Audits, BindingFlags Bindings, SocketFlags Sockets, ObjectAceFlags ObjectAces)))]
readonly partial struct Enums;
Example 4's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/>
///         is an immutable disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factories
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Audits"/> <see langword="as"/> <see cref="System.Security.AccessControl.AuditFlags"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsAudits"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfAudits(System.Security.AccessControl.AuditFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Security.AccessControl.AuditFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Security.AccessControl.AuditFlags)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Bindings"/> <see langword="as"/> <see cref="System.Reflection.BindingFlags"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsBindings"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfBindings(System.Reflection.BindingFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Reflection.BindingFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Reflection.BindingFlags)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Sockets"/> <see langword="as"/> <see cref="System.Net.Sockets.SocketFlags"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsSockets"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfSockets(System.Net.Sockets.SocketFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Net.Sockets.SocketFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Net.Sockets.SocketFlags)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="ObjectAces"/> <see langword="as"/> <see cref="System.Security.AccessControl.ObjectAceFlags"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsObjectAces"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfObjectAces(System.Security.AccessControl.ObjectAceFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Security.AccessControl.ObjectAceFlags)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Security.AccessControl.ObjectAceFlags)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Auto)]
partial struct Enums :
    global::System.IComparable,
    global::System.IComparable<object>,
    global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.Enums>,
#if NET7_0_OR_GREATER
    global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.Enums, global::Emik.SourceGenerators.Choices.Generated.Tests.Enums, bool>,
#endif
    global::System.IEquatable<object>,
    global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.Enums>,
    System.IConvertible,
    System.ISpanFormattable,
    System.IFormattable
{
    /// <summary>
    /// Compact representation of all unmanaged memory within the union <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Explicit)]
    partial struct Unmanaged
    {
        [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
        internal System.Security.AccessControl.AuditFlags _audits;

        [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
        internal System.Reflection.BindingFlags _bindings;

        [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
        internal System.Net.Sockets.SocketFlags _sockets;

        [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
        internal System.Security.AccessControl.ObjectAceFlags _objectAces;
    }

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private readonly byte _discriminator;

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private readonly Unmanaged _unmanaged;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Audits"/> of type <see cref="System.Security.AccessControl.AuditFlags"/>.
    /// </summary>
    /// <param name="audits">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Enums(System.Security.AccessControl.AuditFlags audits)
    {
        _discriminator = 0;
        _unmanaged._audits = audits;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Bindings"/> of type <see cref="System.Reflection.BindingFlags"/>.
    /// </summary>
    /// <param name="bindings">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Enums(System.Reflection.BindingFlags bindings)
    {
        _discriminator = 1;
        _unmanaged._bindings = bindings;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Sockets"/> of type <see cref="System.Net.Sockets.SocketFlags"/>.
    /// </summary>
    /// <param name="sockets">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Enums(System.Net.Sockets.SocketFlags sockets)
    {
        _discriminator = 2;
        _unmanaged._sockets = sockets;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="ObjectAces"/> of type <see cref="System.Security.AccessControl.ObjectAceFlags"/>.
    /// </summary>
    /// <param name="objectAces">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Enums(System.Security.AccessControl.ObjectAceFlags objectAces)
    {
        _discriminator = 3;
        _unmanaged._objectAces = objectAces;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> is the variant <see cref="Audits"/> of type <see cref="System.Security.AccessControl.AuditFlags"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsAudits
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Audits")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> is the variant <see cref="Bindings"/> of type <see cref="System.Reflection.BindingFlags"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsBindings
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Bindings")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> is the variant <see cref="Sockets"/> of type <see cref="System.Net.Sockets.SocketFlags"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsSockets
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Sockets")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 2;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> is the variant <see cref="ObjectAces"/> of type <see cref="System.Security.AccessControl.ObjectAceFlags"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsObjectAces
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "ObjectAces")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 3;
    }

    /// <summary>
    /// Gets the <see cref="System.Security.AccessControl.AuditFlags"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly System.Security.AccessControl.AuditFlags Audits
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0 ? _unmanaged._audits : default;
    }

    /// <summary>
    /// Gets the <see cref="System.Reflection.BindingFlags"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly System.Reflection.BindingFlags Bindings
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1 ? _unmanaged._bindings : default;
    }

    /// <summary>
    /// Gets the <see cref="System.Net.Sockets.SocketFlags"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly System.Net.Sockets.SocketFlags Sockets
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 2 ? _unmanaged._sockets : default;
    }

    /// <summary>
    /// Gets the <see cref="System.Security.AccessControl.ObjectAceFlags"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly System.Security.AccessControl.ObjectAceFlags ObjectAces
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 3 ? _unmanaged._objectAces : default;
    }

    /// <summary>
    /// Implicitly converts the <see cref="System.Security.AccessControl.AuditFlags"/> parameter to the union.
    /// </summary>
    /// <param name="audits">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="audits"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Security.AccessControl.AuditFlags audits)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(audits);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Security.AccessControl.AuditFlags"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Security.AccessControl.AuditFlags(global::Emik.SourceGenerators.Choices.Generated.Tests.Enums x)
        => x.Audits;

    /// <summary>
    /// Implicitly converts the <see cref="System.Reflection.BindingFlags"/> parameter to the union.
    /// </summary>
    /// <param name="bindings">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="bindings"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Reflection.BindingFlags bindings)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(bindings);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Reflection.BindingFlags"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Reflection.BindingFlags(global::Emik.SourceGenerators.Choices.Generated.Tests.Enums x)
        => x.Bindings;

    /// <summary>
    /// Implicitly converts the <see cref="System.Net.Sockets.SocketFlags"/> parameter to the union.
    /// </summary>
    /// <param name="sockets">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="sockets"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Net.Sockets.SocketFlags sockets)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(sockets);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Net.Sockets.SocketFlags"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Net.Sockets.SocketFlags(global::Emik.SourceGenerators.Choices.Generated.Tests.Enums x)
        => x.Sockets;

    /// <summary>
    /// Implicitly converts the <see cref="System.Security.AccessControl.ObjectAceFlags"/> parameter to the union.
    /// </summary>
    /// <param name="objectAces">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="objectAces"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(System.Security.AccessControl.ObjectAceFlags objectAces)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(objectAces);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Security.AccessControl.ObjectAceFlags"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Security.AccessControl.ObjectAceFlags(global::Emik.SourceGenerators.Choices.Generated.Tests.Enums x)
        => x.ObjectAces;

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Audits"/> of type <see cref="System.Security.AccessControl.AuditFlags"/>.
    /// </summary>
    /// <param name="audits">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="audits"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Enums OfAudits(System.Security.AccessControl.AuditFlags audits)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(audits);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Bindings"/> of type <see cref="System.Reflection.BindingFlags"/>.
    /// </summary>
    /// <param name="bindings">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="bindings"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Enums OfBindings(System.Reflection.BindingFlags bindings)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(bindings);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Sockets"/> of type <see cref="System.Net.Sockets.SocketFlags"/>.
    /// </summary>
    /// <param name="sockets">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="sockets"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Enums OfSockets(System.Net.Sockets.SocketFlags sockets)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(sockets);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="ObjectAces"/> of type <see cref="System.Security.AccessControl.ObjectAceFlags"/>.
    /// </summary>
    /// <param name="objectAces">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="objectAces"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Enums OfObjectAces(System.Security.AccessControl.ObjectAceFlags objectAces)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Enums(objectAces);

    /// <summary>
    /// Determines whether the left-hand side is equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.Enums left, Emik.SourceGenerators.Choices.Generated.Tests.Enums right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => left.Audits == right.Audits,
            1 => left.Bindings == right.Bindings,
            2 => left.Sockets == right.Sockets,
            3 => left.ObjectAces == right.ObjectAces,
            _ => throw new global::System.InvalidOperationException(),
        });
    
    /// <summary>
    /// Determines whether the left-hand side is unequal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is unequal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.Enums left, Emik.SourceGenerators.Choices.Generated.Tests.Enums right)
        => !(left == right);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.Enums left, Emik.SourceGenerators.Choices.Generated.Tests.Enums right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => left.Audits > right.Audits,
            1 => left.Bindings > right.Bindings,
            2 => left.Sockets > right.Sockets,
            3 => left.ObjectAces > right.ObjectAces,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.Enums left, Emik.SourceGenerators.Choices.Generated.Tests.Enums right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.Enums left, Emik.SourceGenerators.Choices.Generated.Tests.Enums right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.Enums left, Emik.SourceGenerators.Choices.Generated.Tests.Enums right)
        => right >= left;

    /// <inheritdoc cref="object.Equals(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override bool Equals(object? obj)
        => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Enums x && Equals(x);

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.Enums other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(object? obj)
        => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Enums x ? CompareTo(x) : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.Enums other)
        => Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override int GetHashCode()
        => unchecked(_discriminator * 678563) ^
        (_discriminator switch
        {
            0 => Audits.GetHashCode(),
            1 => Bindings.GetHashCode(),
            2 => Sockets.GetHashCode(),
            3 => ObjectAces.GetHashCode(),
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override string ToString()
        => _discriminator switch
        {
            0 => $"{nameof(Audits)}({Audits})",
            1 => $"{nameof(Bindings)}({Bindings})",
            2 => $"{nameof(Sockets)}({Sockets})",
            3 => $"{nameof(ObjectAces)}({ObjectAces})",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onAudits">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Audits"/> of type <see cref="System.Security.AccessControl.AuditFlags"/> is held.</param>
    /// <param name="onBindings">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Bindings"/> of type <see cref="System.Reflection.BindingFlags"/> is held.</param>
    /// <param name="onSockets">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Sockets"/> of type <see cref="System.Net.Sockets.SocketFlags"/> is held.</param>
    /// <param name="onObjectAces">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="ObjectAces"/> of type <see cref="System.Security.AccessControl.ObjectAceFlags"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly Emik.SourceGenerators.Choices.Generated.Tests.Enums Map(
        global::System.Action<System.Security.AccessControl.AuditFlags>? onAudits = null,
        global::System.Action<System.Reflection.BindingFlags>? onBindings = null,
        global::System.Action<System.Net.Sockets.SocketFlags>? onSockets = null,
        global::System.Action<System.Security.AccessControl.ObjectAceFlags>? onObjectAces = null
    )
    {
        switch (_discriminator)
        {
            case 0:
                onAudits?.Invoke(Audits);
                return this;
            case 1:
                onBindings?.Invoke(Bindings);
                return this;
            case 2:
                onSockets?.Invoke(Sockets);
                return this;
            case 3:
                onObjectAces?.Invoke(ObjectAces);
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onAudits">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Audits"/> of type <see cref="System.Security.AccessControl.AuditFlags"/> is held.</param>
    /// <param name="onBindings">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Bindings"/> of type <see cref="System.Reflection.BindingFlags"/> is held.</param>
    /// <param name="onSockets">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="Sockets"/> of type <see cref="System.Net.Sockets.SocketFlags"/> is held.</param>
    /// <param name="onObjectAces">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Enums"/> struct with the variant <see cref="ObjectAces"/> of type <see cref="System.Security.AccessControl.ObjectAceFlags"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly TMappingResult Map<TMappingResult>(
        global::System.Func<System.Security.AccessControl.AuditFlags, TMappingResult> onAudits,
        global::System.Func<System.Reflection.BindingFlags, TMappingResult> onBindings,
        global::System.Func<System.Net.Sockets.SocketFlags, TMappingResult> onSockets,
        global::System.Func<System.Security.AccessControl.ObjectAceFlags, TMappingResult> onObjectAces
    )
        => _discriminator
        switch
        {
            0 => onAudits(Audits),
            1 => onBindings(Bindings),
            2 => onSockets(Sockets),
            3 => onObjectAces(ObjectAces),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.GetTypeCode()"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.TypeCode GetTypeCode()
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).GetTypeCode(),
            1 => ((System.IConvertible)_unmanaged._bindings).GetTypeCode(),
            2 => ((System.IConvertible)_unmanaged._sockets).GetTypeCode(),
            3 => ((System.IConvertible)_unmanaged._objectAces).GetTypeCode(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToBoolean(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool ToBoolean(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToBoolean(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToBoolean(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToBoolean(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToBoolean(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToByte(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public byte ToByte(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToByte(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToByte(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToByte(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToByte(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToChar(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public char ToChar(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToChar(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToChar(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToChar(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToChar(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToDateTime(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.DateTime ToDateTime(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToDateTime(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToDateTime(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToDateTime(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToDateTime(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToDecimal(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public decimal ToDecimal(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToDecimal(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToDecimal(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToDecimal(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToDecimal(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToDouble(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public double ToDouble(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToDouble(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToDouble(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToDouble(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToDouble(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToInt16(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public short ToInt16(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToInt16(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToInt16(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToInt16(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToInt16(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToInt32(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int ToInt32(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToInt32(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToInt32(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToInt32(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToInt32(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToInt64(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public long ToInt64(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToInt64(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToInt64(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToInt64(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToInt64(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToSByte(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public sbyte ToSByte(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToSByte(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToSByte(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToSByte(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToSByte(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToSingle(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public float ToSingle(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToSingle(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToSingle(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToSingle(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToSingle(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToString(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public string ToString(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToString(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToString(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToString(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToString(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToType(System.Type, System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public object ToType(global::System.Type conversionType, global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToType(conversionType, provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToType(conversionType, provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToType(conversionType, provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToType(conversionType, provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToUInt16(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public ushort ToUInt16(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToUInt16(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToUInt16(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToUInt16(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToUInt16(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToUInt32(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public uint ToUInt32(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToUInt32(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToUInt32(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToUInt32(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToUInt32(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IConvertible.ToUInt64(System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Bindings"/> as <see cref="System.IConvertible"/>,
    /// <see cref="Sockets"/> as <see cref="System.IConvertible"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IConvertible"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public ulong ToUInt64(global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.IConvertible)_unmanaged._audits).ToUInt64(provider),
            1 => ((System.IConvertible)_unmanaged._bindings).ToUInt64(provider),
            2 => ((System.IConvertible)_unmanaged._sockets).ToUInt64(provider),
            3 => ((System.IConvertible)_unmanaged._objectAces).ToUInt64(provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.ISpanFormattable.TryFormat(System.Span{char}, out int, System.ReadOnlySpan{char}, System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.ISpanFormattable"/>,
    /// <see cref="Bindings"/> as <see cref="System.ISpanFormattable"/>,
    /// <see cref="Sockets"/> as <see cref="System.ISpanFormattable"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.ISpanFormattable"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool TryFormat(global::System.Span<char> destination, scoped out int charsWritten, global::System.ReadOnlySpan<char> format, global::System.IFormatProvider? provider)
        => _discriminator switch
        {
            0 => ((System.ISpanFormattable)_unmanaged._audits).TryFormat(destination, out charsWritten, format, provider),
            1 => ((System.ISpanFormattable)_unmanaged._bindings).TryFormat(destination, out charsWritten, format, provider),
            2 => ((System.ISpanFormattable)_unmanaged._sockets).TryFormat(destination, out charsWritten, format, provider),
            3 => ((System.ISpanFormattable)_unmanaged._objectAces).TryFormat(destination, out charsWritten, format, provider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.IFormattable.ToString(string?, System.IFormatProvider?)"/>
    /// <remarks>
    /// Boxes when the current instance is
    /// <see cref="Audits"/> as <see cref="System.IFormattable"/>,
    /// <see cref="Bindings"/> as <see cref="System.IFormattable"/>,
    /// <see cref="Sockets"/> as <see cref="System.IFormattable"/>,
    /// <see cref="ObjectAces"/> as <see cref="System.IFormattable"/>.
    /// </remarks>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public string ToString(string? format, global::System.IFormatProvider? formatProvider)
        => _discriminator switch
        {
            0 => ((System.IFormattable)_unmanaged._audits).ToString(format, formatProvider),
            1 => ((System.IFormattable)_unmanaged._bindings).ToString(format, formatProvider),
            2 => ((System.IFormattable)_unmanaged._sockets).ToString(format, formatProvider),
            3 => ((System.IFormattable)_unmanaged._objectAces).ToString(format, formatProvider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="object.GetType()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Type GetUnderlyingType()
        => _discriminator switch
        {
            0 => typeof(System.Security.AccessControl.AuditFlags),
            1 => typeof(System.Reflection.BindingFlags),
            2 => typeof(System.Net.Sockets.SocketFlags),
            3 => typeof(System.Security.AccessControl.ObjectAceFlags),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Enum.HasFlag(System.Enum)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool HasFlag(global::System.Enum flag)
        => _discriminator switch
        {
            0 => _unmanaged._audits.HasFlag(flag),
            1 => _unmanaged._bindings.HasFlag(flag),
            2 => _unmanaged._sockets.HasFlag(flag),
            3 => _unmanaged._objectAces.HasFlag(flag),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Enum.ToString(string?)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute("EnumFormat")] string? format)
        => _discriminator switch
        {
            0 => _unmanaged._audits.ToString(format),
            1 => _unmanaged._bindings.ToString(format),
            2 => _unmanaged._sockets.ToString(format),
            3 => _unmanaged._objectAces.ToString(format),
            _ => throw new global::System.InvalidOperationException(),
        };
}

// Example 5
[Choice(typeof((Task Referenced, ValueTask Valued)), true)]
partial struct Tasks;
Example 5's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/>
///         is a mutable disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factories
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Referenced"/> <see langword="as"/> <see cref="System.Threading.Tasks.Task"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsReferenced"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfReferenced(System.Threading.Tasks.Task)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks(System.Threading.Tasks.Task)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Threading.Tasks.Task)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Valued"/> <see langword="as"/> <see cref="System.Threading.Tasks.ValueTask"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsValued"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfValued(System.Threading.Tasks.ValueTask)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks(System.Threading.Tasks.ValueTask)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(System.Threading.Tasks.ValueTask)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Auto)]
partial struct Tasks :
    global::System.IComparable,
    global::System.IComparable<object>,
    global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks>,
#if NET7_0_OR_GREATER
    global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks, global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks, bool>,
#endif
    global::System.IEquatable<object>,
    global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks>
{
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private byte _discriminator;

    private System.Threading.Tasks.Task? _referenced;

    private System.Threading.Tasks.ValueTask _valued;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Referenced"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    /// <param name="referenced">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Tasks(System.Threading.Tasks.Task referenced)
    {
        _discriminator = 0;
        _referenced = referenced;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Valued"/> of type <see cref="System.Threading.Tasks.ValueTask"/>.
    /// </summary>
    /// <param name="valued">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Tasks(System.Threading.Tasks.ValueTask valued)
    {
        _discriminator = 1;
        _valued = valued;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> is the variant <see cref="Referenced"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsReferenced
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Referenced")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Valued")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> is the variant <see cref="Valued"/> of type <see cref="System.Threading.Tasks.ValueTask"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsValued
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Valued")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Referenced")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1;
    }

    /// <summary>
    /// Gets or sets the <see cref="System.Threading.Tasks.Task"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.Tasks.Task? Referenced
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        readonly get => _discriminator is 0 ? _referenced : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        set
        {
            _discriminator = 0;
            _referenced = value;
        }
    }

    /// <summary>
    /// Gets or sets the <see cref="System.Threading.Tasks.ValueTask"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.Tasks.ValueTask Valued
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        readonly get => _discriminator is 1 ? _valued : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        set
        {
            _discriminator = 1;
            _valued = value;
        }
    }

    /// <summary>
    /// Implicitly converts the <see cref="System.Threading.Tasks.Task"/> parameter to the union.
    /// </summary>
    /// <param name="referenced">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="referenced"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks(System.Threading.Tasks.Task referenced)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks(referenced);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Threading.Tasks.Task?(global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks x)
        => x.Referenced;

    /// <summary>
    /// Implicitly converts the <see cref="System.Threading.Tasks.ValueTask"/> parameter to the union.
    /// </summary>
    /// <param name="valued">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="valued"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks(System.Threading.Tasks.ValueTask valued)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks(valued);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="System.Threading.Tasks.ValueTask"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator System.Threading.Tasks.ValueTask(global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks x)
        => x.Valued;

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Referenced"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    /// <param name="referenced">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="referenced"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks OfReferenced(System.Threading.Tasks.Task referenced)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks(referenced);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Valued"/> of type <see cref="System.Threading.Tasks.ValueTask"/>.
    /// </summary>
    /// <param name="valued">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="valued"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks OfValued(System.Threading.Tasks.ValueTask valued)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks(valued);

    /// <summary>
    /// Determines whether the left-hand side is equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.Tasks left, Emik.SourceGenerators.Choices.Generated.Tests.Tasks right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => false,
            1 => left.Valued.Equals(right.Valued),
            _ => throw new global::System.InvalidOperationException(),
        });
    
    /// <summary>
    /// Determines whether the left-hand side is unequal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is unequal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.Tasks left, Emik.SourceGenerators.Choices.Generated.Tests.Tasks right)
        => !(left == right);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.Tasks left, Emik.SourceGenerators.Choices.Generated.Tests.Tasks right)
        => (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.Tasks left, Emik.SourceGenerators.Choices.Generated.Tests.Tasks right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.Tasks left, Emik.SourceGenerators.Choices.Generated.Tests.Tasks right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.Tasks left, Emik.SourceGenerators.Choices.Generated.Tests.Tasks right)
        => right >= left;

    /// <inheritdoc cref="object.Equals(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override bool Equals(object? obj)
        => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks x && Equals(x);

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.Tasks other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(object? obj)
        => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Tasks x ? CompareTo(x) : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.Tasks other)
        => Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override int GetHashCode()
        => unchecked(_discriminator * 95603) ^
        (_discriminator switch
        {
            0 => Referenced!.GetHashCode(),
            1 => Valued.GetHashCode(),
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly override string ToString()
        => _discriminator switch
        {
            0 => $"{nameof(Referenced)}({Referenced})",
            1 => $"{nameof(Valued)}({Valued})",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onReferenced">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Referenced"/> of type <see cref="System.Threading.Tasks.Task"/> is held.</param>
    /// <param name="onValued">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Valued"/> of type <see cref="System.Threading.Tasks.ValueTask"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly Emik.SourceGenerators.Choices.Generated.Tests.Tasks Map(
        global::System.Action<System.Threading.Tasks.Task>? onReferenced = null,
        global::System.Action<System.Threading.Tasks.ValueTask>? onValued = null
    )
    {
        switch (_discriminator)
        {
            case 0:
                onReferenced?.Invoke(Referenced!);
                return this;
            case 1:
                onValued?.Invoke(Valued);
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onReferenced">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Referenced"/> of type <see cref="System.Threading.Tasks.Task"/> is held.</param>
    /// <param name="onValued">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Tasks"/> struct with the variant <see cref="Valued"/> of type <see cref="System.Threading.Tasks.ValueTask"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public readonly TMappingResult Map<TMappingResult>(
        global::System.Func<System.Threading.Tasks.Task, TMappingResult> onReferenced,
        global::System.Func<System.Threading.Tasks.ValueTask, TMappingResult> onValued
    )
        => _discriminator
        switch
        {
            0 => onReferenced(Referenced!),
            1 => onValued(Valued),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsCanceled"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsCanceled
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => _referenced!.IsCanceled,
            1 => _valued.IsCanceled,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsCompleted"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsCompleted
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => _referenced!.IsCompleted,
            1 => _valued.IsCompleted,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsCompletedSuccessfully"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public readonly bool IsCompletedSuccessfully
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => _referenced!.IsCompletedSuccessfully,
            1 => _valued.IsCompletedSuccessfully,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsFaulted"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute(true, "Exception")]
    public readonly bool IsFaulted
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => _referenced!.IsFaulted,
            1 => _valued.IsFaulted,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="object.GetType()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Type GetUnderlyingType()
        => _discriminator switch
        {
            0 => _referenced!.GetType(),
            1 => typeof(System.Threading.Tasks.ValueTask),
            _ => throw new global::System.InvalidOperationException(),
        };
}

// Example 6
[Choice(typeof((Task Left, Task Right)), false)]
partial record SuperTask;
Example 6's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/>
///         is a disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factory
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Left"/> <see langword="as"/> <see cref="System.Threading.Tasks.Task"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsLeft"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <see cref="OfLeft(System.Threading.Tasks.Task)"/>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Right"/> <see langword="as"/> <see cref="System.Threading.Tasks.Task"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsRight"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <see cref="OfRight(System.Threading.Tasks.Task)"/>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
partial record SuperTask :
    global::System.IComparable,
    global::System.IComparable<object>,
    global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask>,
#if NET7_0_OR_GREATER
    global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask, global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask, bool>,
#endif
    global::System.IEquatable<object>,
    global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask>,
    System.IAsyncResult,
    System.IDisposable
{
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private byte _discriminator;

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private object? _reference;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Left"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    /// <param name="left">The variant.</param>
    /// <param name="x">The discriminator.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    private SuperTask(System.Threading.Tasks.Task left, byte x)
    {
        _discriminator = x;
        _reference = left;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> is the variant <see cref="Left"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsLeft
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Left")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Right")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> is the variant <see cref="Right"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsRight
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Right")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Left")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1;
    }

    /// <summary>
    /// Gets the <see cref="System.Threading.Tasks.Task"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.Tasks.Task? Left
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 0 ? (System.Threading.Tasks.Task)_reference! : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        private set
        {
            _discriminator = 0;
            _reference = value;
        }
    }

    /// <summary>
    /// Gets the <see cref="System.Threading.Tasks.Task"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.Tasks.Task? Right
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator is 1 ? (System.Threading.Tasks.Task)_reference! : default;
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        private set
        {
            _discriminator = 1;
            _reference = value;
        }
    }

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Left"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    /// <param name="left">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="left"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask OfLeft(System.Threading.Tasks.Task left)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask(left, 0);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Right"/> of type <see cref="System.Threading.Tasks.Task"/>.
    /// </summary>
    /// <param name="right">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="right"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask OfRight(System.Threading.Tasks.Task right)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask(right, 1);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? left, Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? right)
        => left is null ? right is null : right is not null && (left._discriminator == right._discriminator) && (left._discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? left, Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? left, Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? left, Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? right)
        => right >= left;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public virtual bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int CompareTo(object? obj)
        => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.SuperTask x ? CompareTo(x) : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? other)
        => other is null ? 1 : Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override int GetHashCode()
        => unchecked(_discriminator * 12251) ^
        (_discriminator switch
        {
            0 => Left!.GetHashCode(),
            1 => Right!.GetHashCode(),
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override string ToString()
        => _discriminator switch
        {
            0 => $"{nameof(Left)}({Left})",
            1 => $"{nameof(Right)}({Right})",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onLeft">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Left"/> of type <see cref="System.Threading.Tasks.Task"/> is held.</param>
    /// <param name="onRight">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Right"/> of type <see cref="System.Threading.Tasks.Task"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Emik.SourceGenerators.Choices.Generated.Tests.SuperTask? Map(
        global::System.Action<System.Threading.Tasks.Task>? onLeft = null,
        global::System.Action<System.Threading.Tasks.Task>? onRight = null
    )
    {
        switch (_discriminator)
        {
            case 0:
                onLeft?.Invoke(Left!);
                return this;
            case 1:
                onRight?.Invoke(Right!);
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onLeft">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Left"/> of type <see cref="System.Threading.Tasks.Task"/> is held.</param>
    /// <param name="onRight">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.SuperTask"/> record with the variant <see cref="Right"/> of type <see cref="System.Threading.Tasks.Task"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public TMappingResult Map<TMappingResult>(
        global::System.Func<System.Threading.Tasks.Task, TMappingResult> onLeft,
        global::System.Func<System.Threading.Tasks.Task, TMappingResult> onRight
    )
        => _discriminator
        switch
        {
            0 => onLeft(Left!),
            1 => onRight(Right!),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ConfigureAwait(bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Runtime.CompilerServices.ConfiguredTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ConfigureAwait(continueOnCapturedContext),
            1 => ((System.Threading.Tasks.Task)_reference!).ConfigureAwait(continueOnCapturedContext),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ConfigureAwait(System.Threading.Tasks.ConfigureAwaitOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Runtime.CompilerServices.ConfiguredTaskAwaitable ConfigureAwait(global::System.Threading.Tasks.ConfigureAwaitOptions options)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ConfigureAwait(options),
            1 => ((System.Threading.Tasks.Task)_reference!).ConfigureAwait(options),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task, object?}, object?)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task, object?> continuationAction, object? state)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task, object?}, object?, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task, object?> continuationAction, object? state, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task, object?}, object?, System.Threading.CancellationToken, System.Threading.Tasks.TaskContinuationOptions, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task, object?> continuationAction, object? state, global::System.Threading.CancellationToken cancellationToken, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, cancellationToken, continuationOptions, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, cancellationToken, continuationOptions, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task, object?}, object?, System.Threading.Tasks.TaskContinuationOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task, object?> continuationAction, object? state, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, continuationOptions),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, continuationOptions),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task, object?}, object?, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task, object?> continuationAction, object? state, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, state, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task> continuationAction)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task}, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task> continuationAction, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task}, System.Threading.CancellationToken, System.Threading.Tasks.TaskContinuationOptions, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task> continuationAction, global::System.Threading.CancellationToken cancellationToken, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, cancellationToken, continuationOptions, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, cancellationToken, continuationOptions, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task}, System.Threading.Tasks.TaskContinuationOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task> continuationAction, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, continuationOptions),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, continuationOptions),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith(System.Action{System.Threading.Tasks.Task}, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task ContinueWith(global::System.Action<global::System.Threading.Tasks.Task> continuationAction, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith(continuationAction, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, object?, TResult}, object?)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, object?, TResult}, object?, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, object?, TResult}, object?, System.Threading.CancellationToken, System.Threading.Tasks.TaskContinuationOptions, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, global::System.Threading.CancellationToken cancellationToken, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, cancellationToken, continuationOptions, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, cancellationToken, continuationOptions, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, object?, TResult}, object?, System.Threading.Tasks.TaskContinuationOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, continuationOptions),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, continuationOptions),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, object?, TResult}, object?, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, state, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, TResult})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, TResult> continuationFunction)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, TResult}, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, TResult> continuationFunction, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, TResult}, System.Threading.CancellationToken, System.Threading.Tasks.TaskContinuationOptions, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, TResult> continuationFunction, global::System.Threading.CancellationToken cancellationToken, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, cancellationToken, continuationOptions, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, cancellationToken, continuationOptions, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, TResult}, System.Threading.Tasks.TaskContinuationOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, TResult> continuationFunction, global::System.Threading.Tasks.TaskContinuationOptions continuationOptions)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, continuationOptions),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, continuationOptions),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.ContinueWith{TResult}(System.Func{System.Threading.Tasks.Task, TResult}, System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(global::System.Func<global::System.Threading.Tasks.Task, TResult> continuationFunction, global::System.Threading.Tasks.TaskScheduler scheduler)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, scheduler),
            1 => ((System.Threading.Tasks.Task)_reference!).ContinueWith<TResult>(continuationFunction, scheduler),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.Dispose()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void Dispose()
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).Dispose();
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).Dispose();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.GetAwaiter()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Runtime.CompilerServices.TaskAwaiter GetAwaiter()
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).GetAwaiter(),
            1 => ((System.Threading.Tasks.Task)_reference!).GetAwaiter(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.RunSynchronously()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void RunSynchronously()
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).RunSynchronously();
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).RunSynchronously();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.RunSynchronously(System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void RunSynchronously(global::System.Threading.Tasks.TaskScheduler scheduler)
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).RunSynchronously(scheduler);
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).RunSynchronously(scheduler);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Start()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void Start()
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).Start();
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).Start();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Start(System.Threading.Tasks.TaskScheduler)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void Start(global::System.Threading.Tasks.TaskScheduler scheduler)
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).Start(scheduler);
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).Start(scheduler);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Wait()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void Wait()
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).Wait();
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).Wait();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Wait(int)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool Wait(int millisecondsTimeout)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Wait(millisecondsTimeout),
            1 => ((System.Threading.Tasks.Task)_reference!).Wait(millisecondsTimeout),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.Wait(int, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool Wait(int millisecondsTimeout, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Wait(millisecondsTimeout, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).Wait(millisecondsTimeout, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.Wait(System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void Wait(global::System.Threading.CancellationToken cancellationToken)
    {
        switch (_discriminator)
        {
            case 0:
                ((System.Threading.Tasks.Task)_reference!).Wait(cancellationToken);
                break;
            case 1:
                ((System.Threading.Tasks.Task)_reference!).Wait(cancellationToken);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Wait(System.TimeSpan)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool Wait(global::System.TimeSpan timeout)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Wait(timeout),
            1 => ((System.Threading.Tasks.Task)_reference!).Wait(timeout),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.Wait(System.TimeSpan, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool Wait(global::System.TimeSpan timeout, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Wait(timeout, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).Wait(timeout, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.WaitAsync(System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task WaitAsync(global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.WaitAsync(System.TimeSpan)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task WaitAsync(global::System.TimeSpan timeout)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout),
            1 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.WaitAsync(System.TimeSpan, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task WaitAsync(global::System.TimeSpan timeout, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.WaitAsync(System.TimeSpan, System.TimeProvider)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task WaitAsync(global::System.TimeSpan timeout, global::System.TimeProvider timeProvider)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout, timeProvider),
            1 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout, timeProvider),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.WaitAsync(System.TimeSpan, System.TimeProvider, System.Threading.CancellationToken)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Threading.Tasks.Task WaitAsync(global::System.TimeSpan timeout, global::System.TimeProvider timeProvider, global::System.Threading.CancellationToken cancellationToken)
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout, timeProvider, cancellationToken),
            1 => ((System.Threading.Tasks.Task)_reference!).WaitAsync(timeout, timeProvider, cancellationToken),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="System.Threading.Tasks.Task.AsyncState"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public object? AsyncState
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).AsyncState,
            1 => ((System.Threading.Tasks.Task)_reference!).AsyncState,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.CreationOptions"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.Tasks.TaskCreationOptions CreationOptions
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).CreationOptions,
            1 => ((System.Threading.Tasks.Task)_reference!).CreationOptions,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Exception"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.AggregateException? Exception
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Exception,
            1 => ((System.Threading.Tasks.Task)_reference!).Exception,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Id"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public int Id
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Id,
            1 => ((System.Threading.Tasks.Task)_reference!).Id,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsCanceled"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsCanceled
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).IsCanceled,
            1 => ((System.Threading.Tasks.Task)_reference!).IsCanceled,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsCompleted"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsCompleted
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).IsCompleted,
            1 => ((System.Threading.Tasks.Task)_reference!).IsCompleted,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsCompletedSuccessfully"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsCompletedSuccessfully
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).IsCompletedSuccessfully,
            1 => ((System.Threading.Tasks.Task)_reference!).IsCompletedSuccessfully,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.IsFaulted"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute(true, "Exception")]
    public bool IsFaulted
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).IsFaulted,
            1 => ((System.Threading.Tasks.Task)_reference!).IsFaulted,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.Threading.Tasks.Task.Status"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.Tasks.TaskStatus Status
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).Status,
            1 => ((System.Threading.Tasks.Task)_reference!).Status,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.IAsyncResult.AsyncWaitHandle"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public System.Threading.WaitHandle AsyncWaitHandle
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.IAsyncResult)_reference!).AsyncWaitHandle,
            1 => ((System.IAsyncResult)_reference!).AsyncWaitHandle,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="System.IAsyncResult.CompletedSynchronously"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool CompletedSynchronously
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _discriminator switch
        {
            0 => ((System.IAsyncResult)_reference!).CompletedSynchronously,
            1 => ((System.IAsyncResult)_reference!).CompletedSynchronously,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="object.GetType()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Type GetUnderlyingType()
        => _discriminator switch
        {
            0 => ((System.Threading.Tasks.Task)_reference!).GetType(),
            1 => ((System.Threading.Tasks.Task)_reference!).GetType(),
            _ => throw new global::System.InvalidOperationException(),
        };
}

// Example 7
[Choice(typeof((KMBombModule Regular, KMNeedyModule Needy)))]
partial class KMModule
{
    readonly byte _discriminator;
}
Example 7's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
/// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/>
/// <remarks>
///     <para>
///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/>
///         is an immutable disjoint union representing the following variants:
///     </para>
///     <list type="table">
///         <listheader>
///             <term>
///                 <c>Name</c> <see langword="as"/> <c>Type</c>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             Predicate
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             Factories
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </listheader>
///         <item>
///             <term>
///                 <see cref="Regular"/> <see langword="as"/> <see cref="KMBombModule"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsRegular"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfRegular(KMBombModule)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule(KMBombModule)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(KMBombModule)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///         <item>
///             <term>
///                 <see cref="Needy"/> <see langword="as"/> <see cref="KMNeedyModule"/>
///                 <list type="bullet">
///                     <item>
///                         <description>
///                             <see cref="IsNeedy"/>
///                         </description>
///                     </item>
///                     <item>
///                         <description>
///                             <list type="number">
///                                 <item>
///                                     <description>
///                                         <see cref="OfNeedy(KMNeedyModule)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule(KMNeedyModule)"/>
///                                     </description>
///                                 </item>
///                                 <item>
///                                     <description>
///                                         <see cref="op_Implicit(KMNeedyModule)"/>
///                                     </description>
///                                 </item>
///                             </list>
///                         </description>
///                     </item>
///                 </list>
///             </term>
///         </item>
///     </list>
/// </remarks>
partial class KMModule :
    global::System.IComparable,
    global::System.IComparable<object>,
    global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule>,
#if NET7_0_OR_GREATER
    global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule, global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule, bool>,
#endif
    global::System.IEquatable<object>,
    global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule>
{
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private byte Discriminator
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => _reference switch
        {
            KMBombModule => 0,
            KMNeedyModule => 1,
            _ => throw new global::System.InvalidOperationException(),
        };
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        set { }
    }

    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    private readonly object? _reference;

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/>.
    /// </summary>
    /// <param name="regular">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public KMModule(KMBombModule regular)
    {
        Discriminator = 0;
        _reference = regular;
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/>.
    /// </summary>
    /// <param name="needy">The variant.</param>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public KMModule(KMNeedyModule needy)
    {
        Discriminator = 1;
        _reference = needy;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> is the variant <see cref="Regular"/> of type <see cref="KMBombModule"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsRegular
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Regular")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Needy")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator is 0;
    }

    /// <summary>
    /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> is the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/>.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool IsNeedy
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Needy")]
        [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Regular")]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator is 1;
    }

    /// <summary>
    /// Gets the <see cref="KMBombModule"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public KMBombModule? Regular
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator is 0 ? (KMBombModule)_reference! : default;
    }

    /// <summary>
    /// Gets the <see cref="KMNeedyModule"/> variant.
    /// </summary>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public KMNeedyModule? Needy
    {
        [global::System.Diagnostics.Contracts.PureAttribute]
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator is 1 ? (KMNeedyModule)_reference! : default;
    }

    /// <summary>
    /// Implicitly converts the <see cref="KMBombModule"/> parameter to the union.
    /// </summary>
    /// <param name="regular">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="regular"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule(KMBombModule regular)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule(regular);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="KMBombModule"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator KMBombModule?(global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule x)
        => x.Regular;

    /// <summary>
    /// Implicitly converts the <see cref="KMNeedyModule"/> parameter to the union.
    /// </summary>
    /// <param name="needy">The parameter to pass onto the constructor.</param>
    /// <returns>The union containing the parameter <paramref name="needy"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule(KMNeedyModule needy)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule(needy);

    /// <summary>
    /// Explicitly converts the union to the target type <see cref="KMNeedyModule"/>.
    /// </summary>
    /// <param name="x">The union to access its property.</param>
    /// <returns>The getter of the union <paramref name="x"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static explicit operator KMNeedyModule?(global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule x)
        => x.Needy;

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/>.
    /// </summary>
    /// <param name="regular">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="regular"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule OfRegular(KMBombModule regular)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule(regular);

    /// <summary>
    /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/>.
    /// </summary>
    /// <param name="needy">The value to pass into the type.</param>
    /// <returns>The union containing the parameter <paramref name="needy"/>.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule OfNeedy(KMNeedyModule needy)
        => new global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule(needy);

    /// <summary>
    /// Determines whether the left-hand side is equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.KMModule? right)
        => left is null ? right is null : right is not null && (left.Discriminator == right.Discriminator) && (left.Discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });
    
    /// <summary>
    /// Determines whether the left-hand side is unequal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is unequal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.KMModule? right)
        => !(left == right);

    /// <summary>
    /// Determines whether the left-hand side is greater than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.KMModule? right)
        => left is null ? right is null : right is not null && (left.Discriminator == right.Discriminator) && (left.Discriminator
        switch
        {
            0 => false,
            1 => false,
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <summary>
    /// Determines whether the left-hand side is greater than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is greater than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.KMModule? right)
        => left == right || left > right;

    /// <summary>
    /// Determines whether the left-hand side is less than the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.KMModule? right)
        => right > left;

    /// <summary>
    /// Determines whether the left-hand side is less than or equal to the right.
    /// </summary>
    /// <param name="left">The left-hand side.</param>
    /// <param name="right">The right-hand side.</param>
    /// <returns>
    /// The value determining whether the parameter <paramref name="left"/>
    /// is less than or equal to the parameter <paramref name="right"/>.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.KMModule? right)
        => right >= left;

    /// <inheritdoc cref="object.Equals(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override bool Equals(object? obj)
        => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule x && Equals(x);

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? other)
        => this == other;

    /// <inheritdoc cref="IComparable.CompareTo(object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int CompareTo(object? obj)
        => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.KMModule x ? CompareTo(x) : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.KMModule? other)
        => other is null ? 1 : Equals(other) ? 0 : -1;

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override int GetHashCode()
        => unchecked(Discriminator * 429389) ^
        (Discriminator switch
        {
            0 => Regular!.GetHashCode(),
            1 => Needy!.GetHashCode(),
            _ => throw new global::System.InvalidOperationException(),
        });

    /// <inheritdoc />
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public override string ToString()
        => Discriminator switch
        {
            0 => $"{nameof(Regular)}({Regular})",
            1 => $"{nameof(Needy)}({Needy})",
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <summary>
    /// Invokes the callback based on current variance.
    /// </summary>
    /// <param name="onRegular">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/> is held.</param>
    /// <param name="onNeedy">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/> is held.</param>
    /// <returns>Itself.</returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public Emik.SourceGenerators.Choices.Generated.Tests.KMModule? Map(
        global::System.Action<KMBombModule>? onRegular = null,
        global::System.Action<KMNeedyModule>? onNeedy = null
    )
    {
        switch (Discriminator)
        {
            case 0:
                onRegular?.Invoke(Regular!);
                return this;
            case 1:
                onNeedy?.Invoke(Needy!);
                return this;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <summary>
    /// Maps each variant to <typeparamref name="TMappingResult"/>.
    /// </summary>
    /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
    /// <param name="onRegular">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/> is held.</param>
    /// <param name="onNeedy">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.KMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/> is held.</param>
    /// <returns>
    /// The resulting value from one of the parameters based on the current state of the object.
    /// </returns>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Diagnostics.Contracts.PureAttribute]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public TMappingResult Map<TMappingResult>(
        global::System.Func<KMBombModule, TMappingResult> onRegular,
        global::System.Func<KMNeedyModule, TMappingResult> onNeedy
    )
        => Discriminator
        switch
        {
            0 => onRegular(Regular!),
            1 => onNeedy(Needy!),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="KMBombModule.ModuleType"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public string ModuleType
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).ModuleType,
            1 => ((KMNeedyModule)_reference!).ModuleType,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="KMBombModule.ModuleDisplayName"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public string ModuleDisplayName
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).ModuleDisplayName,
            1 => ((KMNeedyModule)_reference!).ModuleDisplayName,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="KMBombModule.RequiresTimerVisibility"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool RequiresTimerVisibility
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).RequiresTimerVisibility,
            1 => ((KMNeedyModule)_reference!).RequiresTimerVisibility,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="KMBombModule.HandlePass()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void HandlePass()
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).HandlePass();
                break;
            case 1:
                ((KMNeedyModule)_reference!).HandlePass();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="KMBombModule.HandleStrike()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void HandleStrike()
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).HandleStrike();
                break;
            case 1:
                ((KMNeedyModule)_reference!).HandleStrike();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="KMBombModule.GetRuleGenerationSeed()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public int GetRuleGenerationSeed()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetRuleGenerationSeed(),
            1 => ((KMNeedyModule)_reference!).GetRuleGenerationSeed(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="object.GetType()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public System.Type GetUnderlyingType()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetType(),
            1 => ((KMNeedyModule)_reference!).GetType(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Object.GetInstanceID()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [System.Security.SecuritySafeCriticalAttribute]
    public int GetInstanceID()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetInstanceID(),
            1 => ((KMNeedyModule)_reference!).GetInstanceID(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Object.name"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public string name
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).name,
            1 => ((KMNeedyModule)_reference!).name,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Object.hideFlags"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public UnityEngine.HideFlags hideFlags
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).hideFlags,
            1 => ((KMNeedyModule)_reference!).hideFlags,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.GetComponent(System.Type)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngineInternal.TypeInferenceRuleAttribute((UnityEngineInternal.TypeInferenceRules)0)]
    public UnityEngine.Component GetComponent(global::System.Type type)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponent(type),
            1 => ((KMNeedyModule)_reference!).GetComponent(type),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponent{T}()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [System.Security.SecuritySafeCriticalAttribute]
    public T GetComponent<T>()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponent<T>(),
            1 => ((KMNeedyModule)_reference!).GetComponent<T>(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponent(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public UnityEngine.Component GetComponent(string type)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponent(type),
            1 => ((KMNeedyModule)_reference!).GetComponent(type),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentInChildren(System.Type, bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngineInternal.TypeInferenceRuleAttribute((UnityEngineInternal.TypeInferenceRules)0)]
    public UnityEngine.Component GetComponentInChildren(global::System.Type t, bool includeInactive)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentInChildren(t, includeInactive),
            1 => ((KMNeedyModule)_reference!).GetComponentInChildren(t, includeInactive),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentInChildren(System.Type)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngineInternal.TypeInferenceRuleAttribute((UnityEngineInternal.TypeInferenceRules)0)]
    public UnityEngine.Component GetComponentInChildren(global::System.Type t)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentInChildren(t),
            1 => ((KMNeedyModule)_reference!).GetComponentInChildren(t),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentInChildren{T}()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public T GetComponentInChildren<T>()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentInChildren<T>(),
            1 => ((KMNeedyModule)_reference!).GetComponentInChildren<T>(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentInChildren{T}(bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T GetComponentInChildren<T>([UnityEngine.Internal.DefaultValueAttribute("false")] bool includeInactive)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentInChildren<T>(includeInactive),
            1 => ((KMNeedyModule)_reference!).GetComponentInChildren<T>(includeInactive),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInChildren(System.Type)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public UnityEngine.Component[] GetComponentsInChildren(global::System.Type t)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInChildren(t),
            1 => ((KMNeedyModule)_reference!).GetComponentsInChildren(t),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInChildren(System.Type, bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public UnityEngine.Component[] GetComponentsInChildren(global::System.Type t, [UnityEngine.Internal.DefaultValueAttribute("false")] bool includeInactive)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInChildren(t, includeInactive),
            1 => ((KMNeedyModule)_reference!).GetComponentsInChildren(t, includeInactive),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInChildren{T}(bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T[] GetComponentsInChildren<T>(bool includeInactive)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInChildren<T>(includeInactive),
            1 => ((KMNeedyModule)_reference!).GetComponentsInChildren<T>(includeInactive),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInChildren{T}(bool, System.Collections.Generic.List{T})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void GetComponentsInChildren<T>(bool includeInactive, global::System.Collections.Generic.List<T> result)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).GetComponentsInChildren<T>(includeInactive, result);
                break;
            case 1:
                ((KMNeedyModule)_reference!).GetComponentsInChildren<T>(includeInactive, result);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInChildren{T}()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T[] GetComponentsInChildren<T>()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInChildren<T>(),
            1 => ((KMNeedyModule)_reference!).GetComponentsInChildren<T>(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInChildren{T}(System.Collections.Generic.List{T})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void GetComponentsInChildren<T>(global::System.Collections.Generic.List<T> results)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).GetComponentsInChildren<T>(results);
                break;
            case 1:
                ((KMNeedyModule)_reference!).GetComponentsInChildren<T>(results);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.GetComponentInParent(System.Type)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngineInternal.TypeInferenceRuleAttribute((UnityEngineInternal.TypeInferenceRules)0)]
    public UnityEngine.Component GetComponentInParent(global::System.Type t)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentInParent(t),
            1 => ((KMNeedyModule)_reference!).GetComponentInParent(t),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentInParent{T}()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T GetComponentInParent<T>()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentInParent<T>(),
            1 => ((KMNeedyModule)_reference!).GetComponentInParent<T>(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInParent(System.Type)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public UnityEngine.Component[] GetComponentsInParent(global::System.Type t)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInParent(t),
            1 => ((KMNeedyModule)_reference!).GetComponentsInParent(t),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInParent(System.Type, bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public UnityEngine.Component[] GetComponentsInParent(global::System.Type t, [UnityEngine.Internal.DefaultValueAttribute("false")] bool includeInactive)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInParent(t, includeInactive),
            1 => ((KMNeedyModule)_reference!).GetComponentsInParent(t, includeInactive),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInParent{T}(bool)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T[] GetComponentsInParent<T>(bool includeInactive)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInParent<T>(includeInactive),
            1 => ((KMNeedyModule)_reference!).GetComponentsInParent<T>(includeInactive),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInParent{T}(bool, System.Collections.Generic.List{T})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void GetComponentsInParent<T>(bool includeInactive, global::System.Collections.Generic.List<T> results)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).GetComponentsInParent<T>(includeInactive, results);
                break;
            case 1:
                ((KMNeedyModule)_reference!).GetComponentsInParent<T>(includeInactive, results);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.GetComponentsInParent{T}()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T[] GetComponentsInParent<T>()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponentsInParent<T>(),
            1 => ((KMNeedyModule)_reference!).GetComponentsInParent<T>(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponents(System.Type)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public UnityEngine.Component[] GetComponents(global::System.Type type)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponents(type),
            1 => ((KMNeedyModule)_reference!).GetComponents(type),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.GetComponents(System.Type, System.Collections.Generic.List{UnityEngine.Component})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void GetComponents(global::System.Type type, global::System.Collections.Generic.List<global::UnityEngine.Component> results)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).GetComponents(type, results);
                break;
            case 1:
                ((KMNeedyModule)_reference!).GetComponents(type, results);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.GetComponents{T}(System.Collections.Generic.List{T})"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void GetComponents<T>(global::System.Collections.Generic.List<T> results)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).GetComponents<T>(results);
                break;
            case 1:
                ((KMNeedyModule)_reference!).GetComponents<T>(results);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.GetComponents{T}()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public T[] GetComponents<T>()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).GetComponents<T>(),
            1 => ((KMNeedyModule)_reference!).GetComponents<T>(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.CompareTag(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool CompareTag(string tag)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).CompareTag(tag),
            1 => ((KMNeedyModule)_reference!).CompareTag(tag),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.Component.SendMessageUpwards(string, object, UnityEngine.SendMessageOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void SendMessageUpwards(string methodName, [UnityEngine.Internal.DefaultValueAttribute("null")] object value, [UnityEngine.Internal.DefaultValueAttribute("SendMessageOptions.RequireReceiver")] global::UnityEngine.SendMessageOptions options)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessageUpwards(methodName, value, options);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessageUpwards(methodName, value, options);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessageUpwards(string, object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public void SendMessageUpwards(string methodName, object value)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessageUpwards(methodName, value);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessageUpwards(methodName, value);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessageUpwards(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public void SendMessageUpwards(string methodName)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessageUpwards(methodName);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessageUpwards(methodName);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessageUpwards(string, UnityEngine.SendMessageOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void SendMessageUpwards(string methodName, global::UnityEngine.SendMessageOptions options)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessageUpwards(methodName, options);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessageUpwards(methodName, options);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessage(string, object, UnityEngine.SendMessageOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void SendMessage(string methodName, [UnityEngine.Internal.DefaultValueAttribute("null")] object value, [UnityEngine.Internal.DefaultValueAttribute("SendMessageOptions.RequireReceiver")] global::UnityEngine.SendMessageOptions options)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessage(methodName, value, options);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessage(methodName, value, options);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessage(string, object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public void SendMessage(string methodName, object value)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessage(methodName, value);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessage(methodName, value);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessage(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public void SendMessage(string methodName)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessage(methodName);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessage(methodName);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.SendMessage(string, UnityEngine.SendMessageOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void SendMessage(string methodName, global::UnityEngine.SendMessageOptions options)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).SendMessage(methodName, options);
                break;
            case 1:
                ((KMNeedyModule)_reference!).SendMessage(methodName, options);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.BroadcastMessage(string, object, UnityEngine.SendMessageOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void BroadcastMessage(string methodName, [UnityEngine.Internal.DefaultValueAttribute("null")] object parameter, [UnityEngine.Internal.DefaultValueAttribute("SendMessageOptions.RequireReceiver")] global::UnityEngine.SendMessageOptions options)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).BroadcastMessage(methodName, parameter, options);
                break;
            case 1:
                ((KMNeedyModule)_reference!).BroadcastMessage(methodName, parameter, options);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.BroadcastMessage(string, object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public void BroadcastMessage(string methodName, object parameter)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).BroadcastMessage(methodName, parameter);
                break;
            case 1:
                ((KMNeedyModule)_reference!).BroadcastMessage(methodName, parameter);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.BroadcastMessage(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public void BroadcastMessage(string methodName)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).BroadcastMessage(methodName);
                break;
            case 1:
                ((KMNeedyModule)_reference!).BroadcastMessage(methodName);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.BroadcastMessage(string, UnityEngine.SendMessageOptions)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void BroadcastMessage(string methodName, global::UnityEngine.SendMessageOptions options)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).BroadcastMessage(methodName, options);
                break;
            case 1:
                ((KMNeedyModule)_reference!).BroadcastMessage(methodName, options);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.Component.transform"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public UnityEngine.Transform transform
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).transform,
            1 => ((KMNeedyModule)_reference!).transform,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.gameObject"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public UnityEngine.GameObject gameObject
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).gameObject,
            1 => ((KMNeedyModule)_reference!).gameObject,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.tag"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public string tag
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).tag,
            1 => ((KMNeedyModule)_reference!).tag,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.rigidbody"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component rigidbody
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).rigidbody,
            1 => ((KMNeedyModule)_reference!).rigidbody,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.rigidbody2D"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property rigidbody2D has been deprecated. Use GetComponent<Rigidbody2D>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component rigidbody2D
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).rigidbody2D,
            1 => ((KMNeedyModule)_reference!).rigidbody2D,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.camera"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property camera has been deprecated. Use GetComponent<Camera>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component camera
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).camera,
            1 => ((KMNeedyModule)_reference!).camera,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.light"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property light has been deprecated. Use GetComponent<Light>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component light
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).light,
            1 => ((KMNeedyModule)_reference!).light,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.animation"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property animation has been deprecated. Use GetComponent<Animation>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component animation
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).animation,
            1 => ((KMNeedyModule)_reference!).animation,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.constantForce"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property constantForce has been deprecated. Use GetComponent<ConstantForce>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component constantForce
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).constantForce,
            1 => ((KMNeedyModule)_reference!).constantForce,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.renderer"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property renderer has been deprecated. Use GetComponent<Renderer>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component renderer
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).renderer,
            1 => ((KMNeedyModule)_reference!).renderer,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.audio"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property audio has been deprecated. Use GetComponent<AudioSource>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component audio
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).audio,
            1 => ((KMNeedyModule)_reference!).audio,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.guiText"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property guiText has been deprecated. Use GetComponent<GUIText>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component guiText
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).guiText,
            1 => ((KMNeedyModule)_reference!).guiText,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.networkView"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property networkView has been deprecated. Use GetComponent<NetworkView>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component networkView
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).networkView,
            1 => ((KMNeedyModule)_reference!).networkView,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.guiElement"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property guiElement has been deprecated. Use GetComponent<GUIElement>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component guiElement
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).guiElement,
            1 => ((KMNeedyModule)_reference!).guiElement,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.guiTexture"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property guiTexture has been deprecated. Use GetComponent<GUITexture>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component guiTexture
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).guiTexture,
            1 => ((KMNeedyModule)_reference!).guiTexture,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.collider"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property collider has been deprecated. Use GetComponent<Collider>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component collider
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).collider,
            1 => ((KMNeedyModule)_reference!).collider,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.collider2D"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property collider2D has been deprecated. Use GetComponent<Collider2D>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component collider2D
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).collider2D,
            1 => ((KMNeedyModule)_reference!).collider2D,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.hingeJoint"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property hingeJoint has been deprecated. Use GetComponent<HingeJoint>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component hingeJoint
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).hingeJoint,
            1 => ((KMNeedyModule)_reference!).hingeJoint,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.particleEmitter"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property particleEmitter has been deprecated. Use GetComponent<ParticleEmitter>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component particleEmitter
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).particleEmitter,
            1 => ((KMNeedyModule)_reference!).particleEmitter,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Component.particleSystem"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [System.ObsoleteAttribute("Property particleSystem has been deprecated. Use GetComponent<ParticleSystem>() instead. (UnityUpgradable)", true)]
    public UnityEngine.Component particleSystem
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).particleSystem,
            1 => ((KMNeedyModule)_reference!).particleSystem,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Behaviour.enabled"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool enabled
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).enabled,
            1 => ((KMNeedyModule)_reference!).enabled,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.Behaviour.isActiveAndEnabled"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool isActiveAndEnabled
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).isActiveAndEnabled,
            1 => ((KMNeedyModule)_reference!).isActiveAndEnabled,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.Invoke(string, float)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void Invoke(string methodName, float time)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).Invoke(methodName, time);
                break;
            case 1:
                ((KMNeedyModule)_reference!).Invoke(methodName, time);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.InvokeRepeating(string, float, float)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void InvokeRepeating(string methodName, float time, float repeatRate)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).InvokeRepeating(methodName, time, repeatRate);
                break;
            case 1:
                ((KMNeedyModule)_reference!).InvokeRepeating(methodName, time, repeatRate);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.CancelInvoke()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void CancelInvoke()
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).CancelInvoke();
                break;
            case 1:
                ((KMNeedyModule)_reference!).CancelInvoke();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.CancelInvoke(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void CancelInvoke(string methodName)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).CancelInvoke(methodName);
                break;
            case 1:
                ((KMNeedyModule)_reference!).CancelInvoke(methodName);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.IsInvoking(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool IsInvoking(string methodName)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).IsInvoking(methodName),
            1 => ((KMNeedyModule)_reference!).IsInvoking(methodName),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.IsInvoking()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public bool IsInvoking()
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).IsInvoking(),
            1 => ((KMNeedyModule)_reference!).IsInvoking(),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public UnityEngine.Coroutine StartCoroutine(global::System.Collections.IEnumerator routine)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).StartCoroutine(routine),
            1 => ((KMNeedyModule)_reference!).StartCoroutine(routine),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StartCoroutine_Auto(System.Collections.IEnumerator)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [System.ObsoleteAttribute("StartCoroutine_Auto has been deprecated. Use StartCoroutine instead (UnityUpgradable) -> StartCoroutine([mscorlib] System.Collections.IEnumerator)", false)]
    public UnityEngine.Coroutine StartCoroutine_Auto(global::System.Collections.IEnumerator routine)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).StartCoroutine_Auto(routine),
            1 => ((KMNeedyModule)_reference!).StartCoroutine_Auto(routine),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StartCoroutine(string, object)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public UnityEngine.Coroutine StartCoroutine(string methodName, [UnityEngine.Internal.DefaultValueAttribute("null")] object value)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).StartCoroutine(methodName, value),
            1 => ((KMNeedyModule)_reference!).StartCoroutine(methodName, value),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StartCoroutine(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    [UnityEngine.Internal.ExcludeFromDocsAttribute]
    public UnityEngine.Coroutine StartCoroutine(string methodName)
        => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).StartCoroutine(methodName),
            1 => ((KMNeedyModule)_reference!).StartCoroutine(methodName),
            _ => throw new global::System.InvalidOperationException(),
        };

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StopCoroutine(string)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void StopCoroutine(string methodName)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).StopCoroutine(methodName);
                break;
            case 1:
                ((KMNeedyModule)_reference!).StopCoroutine(methodName);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StopCoroutine(System.Collections.IEnumerator)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void StopCoroutine(global::System.Collections.IEnumerator routine)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).StopCoroutine(routine);
                break;
            case 1:
                ((KMNeedyModule)_reference!).StopCoroutine(routine);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StopCoroutine(UnityEngine.Coroutine)"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void StopCoroutine(global::UnityEngine.Coroutine routine)
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).StopCoroutine(routine);
                break;
            case 1:
                ((KMNeedyModule)_reference!).StopCoroutine(routine);
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.StopAllCoroutines()"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    [global::System.Runtime.CompilerServices.MethodImpl(256)]
    public void StopAllCoroutines()
    {
        switch (Discriminator)
        {
            case 0:
                ((KMBombModule)_reference!).StopAllCoroutines();
                break;
            case 1:
                ((KMNeedyModule)_reference!).StopAllCoroutines();
                break;
            default: throw new global::System.InvalidOperationException();
        }
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.useGUILayout"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool useGUILayout
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).useGUILayout,
            1 => ((KMNeedyModule)_reference!).useGUILayout,
            _ => throw new global::System.InvalidOperationException(),
        };
    }

    /// <inheritdoc cref="UnityEngine.MonoBehaviour.runInEditMode"/>
    [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.2.0.0")]
    public bool runInEditMode
    {
        [global::System.Runtime.CompilerServices.MethodImpl(256)]
        get => Discriminator switch
        {
            0 => ((KMBombModule)_reference!).runInEditMode,
            1 => ((KMNeedyModule)_reference!).runInEditMode,
            _ => throw new global::System.InvalidOperationException(),
        };
    }
}

// Example 8
[Choice.Regular<KMBombModule>.Needy<KMNeedyModule>.Other<Component>]
partial class DotKMModule;
Example 8's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
namespace Emik
{
    namespace SourceGenerators
    {
        namespace Choices
        {
            namespace Generated
            {
                namespace Tests
                {
                    /// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/>
                    /// <remarks>
                    ///     <para>
                    ///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/>
                    ///         is an immutable disjoint union representing the following variants:
                    ///     </para>
                    ///     <list type="table">
                    ///         <listheader>
                    ///             <term>
                    ///                 <c>Name</c> <see langword="as"/> <c>Type</c>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             Predicate
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             Factories
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </listheader>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Regular"/> <see langword="as"/> <see cref="KMBombModule"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsRegular"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfRegular(KMBombModule)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(KMBombModule)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(KMBombModule)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Needy"/> <see langword="as"/> <see cref="KMNeedyModule"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsNeedy"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfNeedy(KMNeedyModule)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(KMNeedyModule)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(KMNeedyModule)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Other"/> <see langword="as"/> <see cref="System.ComponentModel.Component"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsOther"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfOther(System.ComponentModel.Component)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(System.ComponentModel.Component)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(System.ComponentModel.Component)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///     </list>
                    /// </remarks>
                    partial class DotKMModule :
                        global::System.IComparable,
                        global::System.IComparable<object>,
                        global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule>,
#if NET7_0_OR_GREATER
                        global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule, global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule, bool>,
#endif
                        global::System.IEquatable<object>,
                        global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule>
                    {
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                        private static class Choice
                        {
                            [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                            internal static class Regular<TRegularDiscard>
                            {
                                [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                                internal static class Needy<TNeedyDiscard>
                                {
                                    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                                    internal sealed class Other<TOtherDiscard> : global::System.Attribute
                                    {
                                    }
                                }
                            }
                        }

                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        private byte Discriminator
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _reference switch
                            {
                                KMBombModule => 0,
                                KMNeedyModule => 1,
                                System.ComponentModel.Component => 2,
                                _ => throw new global::System.InvalidOperationException(),
                            };
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            set { }
                        }

                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        private readonly object? _reference;

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/>.
                        /// </summary>
                        /// <param name="regular">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public DotKMModule(KMBombModule regular)
                        {
                            Discriminator = 0;
                            _reference = regular;
                        }

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/>.
                        /// </summary>
                        /// <param name="needy">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public DotKMModule(KMNeedyModule needy)
                        {
                            Discriminator = 1;
                            _reference = needy;
                        }

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Other"/> of type <see cref="System.ComponentModel.Component"/>.
                        /// </summary>
                        /// <param name="other">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public DotKMModule(System.ComponentModel.Component other)
                        {
                            Discriminator = 2;
                            _reference = other;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> is the variant <see cref="Regular"/> of type <see cref="KMBombModule"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public bool IsRegular
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Regular")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 0;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> is the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public bool IsNeedy
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Needy")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 1;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> is the variant <see cref="Other"/> of type <see cref="System.ComponentModel.Component"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public bool IsOther
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Other")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 2;
                        }

                        /// <summary>
                        /// Gets the <see cref="KMBombModule"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public KMBombModule? Regular
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 0 ? (KMBombModule)_reference! : default;
                        }

                        /// <summary>
                        /// Gets the <see cref="KMNeedyModule"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public KMNeedyModule? Needy
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 1 ? (KMNeedyModule)_reference! : default;
                        }

                        /// <summary>
                        /// Gets the <see cref="System.ComponentModel.Component"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public System.ComponentModel.Component? Other
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 2 ? (System.ComponentModel.Component)_reference! : default;
                        }

                        /// <summary>
                        /// Implicitly converts the <see cref="KMBombModule"/> parameter to the union.
                        /// </summary>
                        /// <param name="regular">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="regular"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(KMBombModule regular)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(regular);

                        /// <summary>
                        /// Explicitly converts the union to the target type <see cref="KMBombModule"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator KMBombModule?(global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule x)
                            => x.Regular;

                        /// <summary>
                        /// Implicitly converts the <see cref="KMNeedyModule"/> parameter to the union.
                        /// </summary>
                        /// <param name="needy">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="needy"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(KMNeedyModule needy)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(needy);

                        /// <summary>
                        /// Explicitly converts the union to the target type <see cref="KMNeedyModule"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator KMNeedyModule?(global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule x)
                            => x.Needy;

                        /// <summary>
                        /// Implicitly converts the <see cref="System.ComponentModel.Component"/> parameter to the union.
                        /// </summary>
                        /// <param name="other">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="other"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(System.ComponentModel.Component other)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(other);

                        /// <summary>
                        /// Explicitly converts the union to the target type <see cref="System.ComponentModel.Component"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator System.ComponentModel.Component?(global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule x)
                            => x.Other;

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/>.
                        /// </summary>
                        /// <param name="regular">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="regular"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule OfRegular(KMBombModule regular)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(regular);

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/>.
                        /// </summary>
                        /// <param name="needy">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="needy"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule OfNeedy(KMNeedyModule needy)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(needy);

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Other"/> of type <see cref="System.ComponentModel.Component"/>.
                        /// </summary>
                        /// <param name="other">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="other"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule OfOther(System.ComponentModel.Component other)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule(other);

                        /// <summary>
                        /// Determines whether the left-hand side is equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? right)
                            => left is null ? right is null : right is not null && (left.Discriminator == right.Discriminator) && (left.Discriminator
                            switch
                            {
                                0 => false,
                                1 => false,
                                2 => false,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <summary>
                        /// Determines whether the left-hand side is unequal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is unequal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? right)
                            => !(left == right);

                        /// <summary>
                        /// Determines whether the left-hand side is greater than the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is greater than the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? right)
                            => left is null ? right is null : right is not null && (left.Discriminator == right.Discriminator) && (left.Discriminator
                            switch
                            {
                                0 => false,
                                1 => false,
                                2 => false,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <summary>
                        /// Determines whether the left-hand side is greater than or equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is greater than or equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? right)
                            => left == right || left > right;

                        /// <summary>
                        /// Determines whether the left-hand side is less than the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is less than the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? right)
                            => right > left;

                        /// <summary>
                        /// Determines whether the left-hand side is less than or equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is less than or equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? left, Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? right)
                            => right >= left;

                        /// <inheritdoc cref="object.Equals(object)"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override bool Equals(object? obj)
                            => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule x && Equals(x);

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? other)
                            => this == other;

                        /// <inheritdoc cref="IComparable.CompareTo(object)"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public int CompareTo(object? obj)
                            => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule x ? CompareTo(x) : -1;

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? other)
                            => other is null ? 1 : Equals(other) ? 0 : -1;

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override int GetHashCode()
                            => unchecked(Discriminator * 3) ^
                            (Discriminator switch
                            {
                                0 => ((KMBombModule)_reference!).GetHashCode(),
                                1 => ((KMNeedyModule)_reference!).GetHashCode(),
                                2 => ((System.ComponentModel.Component)_reference!).GetHashCode(),
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override string ToString()
                            => Discriminator switch
                            {
                                0 => $"{nameof(Regular)}({((KMBombModule)_reference!)})",
                                1 => $"{nameof(Needy)}({((KMNeedyModule)_reference!)})",
                                2 => $"{nameof(Other)}({((System.ComponentModel.Component)_reference!)})",
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <summary>
                        /// Invokes the callback based on current variance.
                        /// </summary>
                        /// <param name="onRegular">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/> is held.</param>
                        /// <param name="onNeedy">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/> is held.</param>
                        /// <param name="onOther">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Other"/> of type <see cref="System.ComponentModel.Component"/> is held.</param>
                        /// <returns>Itself.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule? Map(
                            global::System.Action<KMBombModule>? onRegular = null,
                            global::System.Action<KMNeedyModule>? onNeedy = null,
                            global::System.Action<System.ComponentModel.Component>? onOther = null
                        )
                        {
                            switch (Discriminator)
                            {
                                case 0:
                                    onRegular?.Invoke(((KMBombModule)_reference!));
                                    return this;
                                case 1:
                                    onNeedy?.Invoke(((KMNeedyModule)_reference!));
                                    return this;
                                case 2:
                                    onOther?.Invoke(((System.ComponentModel.Component)_reference!));
                                    return this;
                                default: throw new global::System.InvalidOperationException();
                            }
                        }

                        /// <summary>
                        /// Maps each variant to <typeparamref name="TMappingResult"/>.
                        /// </summary>
                        /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
                        /// <param name="onRegular">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Regular"/> of type <see cref="KMBombModule"/> is held.</param>
                        /// <param name="onNeedy">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Needy"/> of type <see cref="KMNeedyModule"/> is held.</param>
                        /// <param name="onOther">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotKMModule"/> class with the variant <see cref="Other"/> of type <see cref="System.ComponentModel.Component"/> is held.</param>
                        /// <returns>
                        /// The resulting value from one of the parameters based on the current state of the object.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public TMappingResult Map<TMappingResult>(
                            global::System.Func<KMBombModule, TMappingResult> onRegular,
                            global::System.Func<KMNeedyModule, TMappingResult> onNeedy,
                            global::System.Func<System.ComponentModel.Component, TMappingResult> onOther
                        )
                            => Discriminator
                            switch
                            {
                                0 => onRegular(((KMBombModule)_reference!)),
                                1 => onNeedy(((KMNeedyModule)_reference!)),
                                2 => onOther(((System.ComponentModel.Component)_reference!)),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <summary>
                        /// Gets the underlying value.
                        /// </summary>
                        /// <returns>
                        /// The underlying value from this instance.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public object GetUnderlyingValue()
                            => _reference!;

                        /// <inheritdoc cref="object.GetType()"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public System.Type GetUnderlyingType()
                            => Discriminator switch
                            {
                                0 => ((KMBombModule)_reference!).GetType(),
                                1 => ((KMNeedyModule)_reference!).GetType(),
                                2 => ((System.ComponentModel.Component)_reference!).GetType(),
                                _ => throw new global::System.InvalidOperationException(),
                            };
                    }
                }
            }
        }
    }
}

// Example 9
[Choice.Apple<byte>.Pear<int>.Orange<BindingFlags>]
sealed partial class DotFruit;
Example 9's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
namespace Emik
{
    namespace SourceGenerators
    {
        namespace Choices
        {
            namespace Generated
            {
                namespace Tests
                {
                    /// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/>
                    /// <remarks>
                    ///     <para>
                    ///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/>
                    ///         is an immutable disjoint union representing the following variants:
                    ///     </para>
                    ///     <list type="table">
                    ///         <listheader>
                    ///             <term>
                    ///                 <c>Name</c> <see langword="as"/> <c>Type</c>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             Predicate
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             Factories
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </listheader>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Apple"/> <see langword="as"/> <see cref="byte"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsApple"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfApple(byte)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(byte)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(byte)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Pear"/> <see langword="as"/> <see cref="int"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsPear"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfPear(int)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(int)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(int)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Orange"/> <see langword="as"/> <see cref="System.Reflection.BindingFlags"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsOrange"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfOrange(System.Reflection.BindingFlags)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(System.Reflection.BindingFlags)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(System.Reflection.BindingFlags)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///     </list>
                    /// </remarks>
                    partial class DotFruit :
                        global::System.IComparable,
                        global::System.IComparable<object>,
                        global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit>,
#if NET7_0_OR_GREATER
                        global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit, global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit, bool>,
#endif
                        global::System.IEquatable<object>,
                        global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit>,
                        System.IConvertible,
                        System.ISpanFormattable,
                        System.IFormattable
                    {
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                        private static class Choice
                        {
                            [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                            internal static class Apple<TAppleDiscard>
                            {
                                [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                                internal static class Pear<TPearDiscard>
                                {
                                    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
                                    internal sealed class Orange<TOrangeDiscard> : global::System.Attribute
                                    {
                                    }
                                }
                            }
                        }

                        /// <summary>
                        /// Compact representation of all unmanaged memory within the union <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Explicit)]
                        partial struct Unmanaged
                        {
                            [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
                            internal byte _apple;

                            [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
                            internal int _pear;

                            [global::System.Runtime.InteropServices.FieldOffsetAttribute(0)]
                            internal System.Reflection.BindingFlags _orange;
                        }

                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        private readonly byte _discriminator;

                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        private readonly Unmanaged _unmanaged;

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Apple"/> of type <see cref="byte"/>.
                        /// </summary>
                        /// <param name="apple">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public DotFruit(byte apple)
                        {
                            _discriminator = 0;
                            _unmanaged._apple = apple;
                        }

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Pear"/> of type <see cref="int"/>.
                        /// </summary>
                        /// <param name="pear">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public DotFruit(int pear)
                        {
                            _discriminator = 1;
                            _unmanaged._pear = pear;
                        }

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Orange"/> of type <see cref="System.Reflection.BindingFlags"/>.
                        /// </summary>
                        /// <param name="orange">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public DotFruit(System.Reflection.BindingFlags orange)
                        {
                            _discriminator = 2;
                            _unmanaged._orange = orange;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> is the variant <see cref="Apple"/> of type <see cref="byte"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public bool IsApple
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Apple")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _discriminator is 0;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> is the variant <see cref="Pear"/> of type <see cref="int"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public bool IsPear
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Pear")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _discriminator is 1;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> is the variant <see cref="Orange"/> of type <see cref="System.Reflection.BindingFlags"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public bool IsOrange
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Orange")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _discriminator is 2;
                        }

                        /// <summary>
                        /// Gets the <see cref="byte"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public byte Apple
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _discriminator is 0 ? _unmanaged._apple : default;
                        }

                        /// <summary>
                        /// Gets the <see cref="int"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public int Pear
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _discriminator is 1 ? _unmanaged._pear : default;
                        }

                        /// <summary>
                        /// Gets the <see cref="System.Reflection.BindingFlags"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        public System.Reflection.BindingFlags Orange
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _discriminator is 2 ? _unmanaged._orange : default;
                        }

                        /// <summary>
                        /// Implicitly converts the <see cref="byte"/> parameter to the union.
                        /// </summary>
                        /// <param name="apple">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="apple"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(byte apple)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(apple);

                        /// <summary>
                        /// Explicitly converts the union to the target type <see cref="byte"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator byte(global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit x)
                            => x.Apple;

                        /// <summary>
                        /// Implicitly converts the <see cref="int"/> parameter to the union.
                        /// </summary>
                        /// <param name="pear">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="pear"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(int pear)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(pear);

                        /// <summary>
                        /// Explicitly converts the union to the target type <see cref="int"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator int(global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit x)
                            => x.Pear;

                        /// <summary>
                        /// Implicitly converts the <see cref="System.Reflection.BindingFlags"/> parameter to the union.
                        /// </summary>
                        /// <param name="orange">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="orange"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(System.Reflection.BindingFlags orange)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(orange);

                        /// <summary>
                        /// Explicitly converts the union to the target type <see cref="System.Reflection.BindingFlags"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator System.Reflection.BindingFlags(global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit x)
                            => x.Orange;

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Apple"/> of type <see cref="byte"/>.
                        /// </summary>
                        /// <param name="apple">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="apple"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit OfApple(byte apple)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(apple);

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Pear"/> of type <see cref="int"/>.
                        /// </summary>
                        /// <param name="pear">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="pear"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit OfPear(int pear)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(pear);

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Orange"/> of type <see cref="System.Reflection.BindingFlags"/>.
                        /// </summary>
                        /// <param name="orange">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="orange"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit OfOrange(System.Reflection.BindingFlags orange)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit(orange);

                        /// <summary>
                        /// Determines whether the left-hand side is equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? left, Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? right)
                            => left is null ? right is null : right is not null && (left._discriminator == right._discriminator) && (left._discriminator
                            switch
                            {
                                0 => left._unmanaged._apple == right._unmanaged._apple,
                                1 => left._unmanaged._pear == right._unmanaged._pear,
                                2 => left._unmanaged._orange == right._unmanaged._orange,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <summary>
                        /// Determines whether the left-hand side is unequal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is unequal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? left, Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? right)
                            => !(left == right);

                        /// <summary>
                        /// Determines whether the left-hand side is greater than the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is greater than the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? left, Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? right)
                            => left is null ? right is null : right is not null && (left._discriminator == right._discriminator) && (left._discriminator
                            switch
                            {
                                0 => left._unmanaged._apple > right._unmanaged._apple,
                                1 => left._unmanaged._pear > right._unmanaged._pear,
                                2 => left._unmanaged._orange > right._unmanaged._orange,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <summary>
                        /// Determines whether the left-hand side is greater than or equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is greater than or equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? left, Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? right)
                            => left == right || left > right;

                        /// <summary>
                        /// Determines whether the left-hand side is less than the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is less than the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? left, Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? right)
                            => right > left;

                        /// <summary>
                        /// Determines whether the left-hand side is less than or equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is less than or equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? left, Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? right)
                            => right >= left;

                        /// <inheritdoc cref="object.Equals(object)"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override bool Equals(object? obj)
                            => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit x && Equals(x);

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? other)
                            => this == other;

                        /// <inheritdoc cref="IComparable.CompareTo(object)"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public int CompareTo(object? obj)
                            => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.DotFruit x ? CompareTo(x) : -1;

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? other)
                            => other is null ? 1 : Equals(other) ? 0 : -1;

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override int GetHashCode()
                            => unchecked(_discriminator * 5) ^
                            (_discriminator switch
                            {
                                0 => _unmanaged._apple.GetHashCode(),
                                1 => _unmanaged._pear.GetHashCode(),
                                2 => _unmanaged._orange.GetHashCode(),
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override string ToString()
                            => _discriminator switch
                            {
                                0 => $"{nameof(Apple)}({_unmanaged._apple})",
                                1 => $"{nameof(Pear)}({_unmanaged._pear})",
                                2 => $"{nameof(Orange)}({_unmanaged._orange})",
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <summary>
                        /// Invokes the callback based on current variance.
                        /// </summary>
                        /// <param name="onApple">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Apple"/> of type <see cref="byte"/> is held.</param>
                        /// <param name="onPear">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Pear"/> of type <see cref="int"/> is held.</param>
                        /// <param name="onOrange">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Orange"/> of type <see cref="System.Reflection.BindingFlags"/> is held.</param>
                        /// <returns>Itself.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public Emik.SourceGenerators.Choices.Generated.Tests.DotFruit? Map(
                            global::System.Action<byte>? onApple = null,
                            global::System.Action<int>? onPear = null,
                            global::System.Action<System.Reflection.BindingFlags>? onOrange = null
                        )
                        {
                            switch (_discriminator)
                            {
                                case 0:
                                    onApple?.Invoke(_unmanaged._apple);
                                    return this;
                                case 1:
                                    onPear?.Invoke(_unmanaged._pear);
                                    return this;
                                case 2:
                                    onOrange?.Invoke(_unmanaged._orange);
                                    return this;
                                default: throw new global::System.InvalidOperationException();
                            }
                        }

                        /// <summary>
                        /// Maps each variant to <typeparamref name="TMappingResult"/>.
                        /// </summary>
                        /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
                        /// <param name="onApple">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Apple"/> of type <see cref="byte"/> is held.</param>
                        /// <param name="onPear">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Pear"/> of type <see cref="int"/> is held.</param>
                        /// <param name="onOrange">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.DotFruit"/> class with the variant <see cref="Orange"/> of type <see cref="System.Reflection.BindingFlags"/> is held.</param>
                        /// <returns>
                        /// The resulting value from one of the parameters based on the current state of the object.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public TMappingResult Map<TMappingResult>(
                            global::System.Func<byte, TMappingResult> onApple,
                            global::System.Func<int, TMappingResult> onPear,
                            global::System.Func<System.Reflection.BindingFlags, TMappingResult> onOrange
                        )
                            => _discriminator
                            switch
                            {
                                0 => onApple(_unmanaged._apple),
                                1 => onPear(_unmanaged._pear),
                                2 => onOrange(_unmanaged._orange),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <summary>
                        /// Gets the underlying value.
                        /// </summary>
                        /// <returns>
                        /// The underlying value from this instance.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public System.ISpanFormattable GetUnderlyingValue()
                            => _discriminator
                    switch
                    {
                        0 => _unmanaged._apple,
                                1 => _unmanaged._pear,
                                2 => _unmanaged._orange,
                        _ => throw new global::System.InvalidOperationException(),
                    };

                        /// <inheritdoc cref="System.IConvertible.GetTypeCode()"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public System.TypeCode GetTypeCode()
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).GetTypeCode(),
                                1 => ((System.IConvertible)_unmanaged._pear).GetTypeCode(),
                                2 => ((System.IConvertible)_unmanaged._orange).GetTypeCode(),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToBoolean(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public bool ToBoolean(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToBoolean(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToBoolean(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToBoolean(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToByte(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public byte ToByte(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToByte(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToByte(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToByte(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToChar(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public char ToChar(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToChar(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToChar(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToChar(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToDateTime(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public System.DateTime ToDateTime(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToDateTime(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToDateTime(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToDateTime(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToDecimal(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public decimal ToDecimal(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToDecimal(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToDecimal(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToDecimal(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToDouble(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public double ToDouble(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToDouble(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToDouble(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToDouble(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToInt16(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public short ToInt16(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToInt16(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToInt16(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToInt16(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToInt32(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public int ToInt32(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToInt32(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToInt32(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToInt32(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToInt64(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public long ToInt64(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToInt64(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToInt64(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToInt64(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToSByte(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public sbyte ToSByte(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToSByte(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToSByte(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToSByte(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToSingle(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public float ToSingle(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToSingle(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToSingle(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToSingle(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToString(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public string ToString(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToString(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToString(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToString(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToType(System.Type, System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public object ToType(global::System.Type conversionType, global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToType(conversionType, provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToType(conversionType, provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToType(conversionType, provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToUInt16(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public ushort ToUInt16(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToUInt16(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToUInt16(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToUInt16(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToUInt32(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public uint ToUInt32(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToUInt32(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToUInt32(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToUInt32(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IConvertible.ToUInt64(System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Pear"/> as <see cref="System.IConvertible"/>,
                        /// <see cref="Orange"/> as <see cref="System.IConvertible"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public ulong ToUInt64(global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.IConvertible)_unmanaged._apple).ToUInt64(provider),
                                1 => ((System.IConvertible)_unmanaged._pear).ToUInt64(provider),
                                2 => ((System.IConvertible)_unmanaged._orange).ToUInt64(provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.ISpanFormattable.TryFormat(System.Span{char}, out int, System.ReadOnlySpan{char}, System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.ISpanFormattable"/>,
                        /// <see cref="Pear"/> as <see cref="System.ISpanFormattable"/>,
                        /// <see cref="Orange"/> as <see cref="System.ISpanFormattable"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public bool TryFormat(global::System.Span<char> destination, scoped out int charsWritten, global::System.ReadOnlySpan<char> format, global::System.IFormatProvider? provider)
                            => _discriminator switch
                            {
                                0 => ((System.ISpanFormattable)_unmanaged._apple).TryFormat(destination, out charsWritten, format, provider),
                                1 => ((System.ISpanFormattable)_unmanaged._pear).TryFormat(destination, out charsWritten, format, provider),
                                2 => ((System.ISpanFormattable)_unmanaged._orange).TryFormat(destination, out charsWritten, format, provider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="System.IFormattable.ToString(string?, System.IFormatProvider?)"/>
                        /// <remarks>
                        /// Boxes when the current instance is
                        /// <see cref="Apple"/> as <see cref="System.IFormattable"/>,
                        /// <see cref="Pear"/> as <see cref="System.IFormattable"/>,
                        /// <see cref="Orange"/> as <see cref="System.IFormattable"/>.
                        /// </remarks>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public string ToString(string? format, global::System.IFormatProvider? formatProvider)
                            => _discriminator switch
                            {
                                0 => ((System.IFormattable)_unmanaged._apple).ToString(format, formatProvider),
                                1 => ((System.IFormattable)_unmanaged._pear).ToString(format, formatProvider),
                                2 => ((System.IFormattable)_unmanaged._orange).ToString(format, formatProvider),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <inheritdoc cref="object.GetType()"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.0.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public System.Type GetUnderlyingType()
                            => _discriminator switch
                            {
                                0 => typeof(byte),
                                1 => typeof(int),
                                2 => typeof(System.Reflection.BindingFlags),
                                _ => throw new global::System.InvalidOperationException(),
                            };
                    }
                }
            }
        }
    }
}

// Example 10
[Choice]
readonly partial struct Option<T>
    where T : class
{
    readonly T? _some;

    ValueTuple None => default;
}
Example 10's Output
// <auto-generated/>
// ReSharper disable RedundantNameQualifier
// ReSharper disable once CheckNamespace
#nullable enable
#pragma warning disable
namespace Emik
{
    namespace SourceGenerators
    {
        namespace Choices
        {
            namespace Generated
            {
                namespace Tests
                {
                    /// <inheritdoc cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/>
                    /// <remarks>
                    ///     <para>
                    ///         The type <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/>
                    ///         is an immutable disjoint union representing the following variants:
                    ///     </para>
                    ///     <list type="table">
                    ///         <listheader>
                    ///             <term>
                    ///                 <c>Name</c> <see langword="as"/> <c>Type</c>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             Predicate
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             Factories
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </listheader>
                    ///         <item>
                    ///             <term>
                    ///                 <see cref="Some"/> <see langword="as"/> <typeparamref name="T"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsSome"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfSome(T?)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}(T?)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(T?)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///         <item>
                    ///             <term>
                    ///                 None <see langword="as"/> <see cref="System.ValueTuple"/>
                    ///                 <list type="bullet">
                    ///                     <item>
                    ///                         <description>
                    ///                             <see cref="IsNone"/>
                    ///                         </description>
                    ///                     </item>
                    ///                     <item>
                    ///                         <description>
                    ///                             <list type="number">
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="OfNone(System.ValueTuple)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}(System.ValueTuple)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                                 <item>
                    ///                                     <description>
                    ///                                         <see cref="op_Implicit(System.ValueTuple)"/>
                    ///                                     </description>
                    ///                                 </item>
                    ///                             </list>
                    ///                         </description>
                    ///                     </item>
                    ///                 </list>
                    ///             </term>
                    ///         </item>
                    ///     </list>
                    /// </remarks>
                    [global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Auto)]
                    partial struct Option<T> :
                        global::System.IComparable,
                        global::System.IComparable<object>,
                        global::System.IComparable<global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>>,
#if NET7_0_OR_GREATER
                        global::System.Numerics.IComparisonOperators<global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>, global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>, bool>,
#endif
                        global::System.IEquatable<object>,
                        global::System.IEquatable<global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>>
                    {
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        private readonly byte Discriminator
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => _reference switch
                            {
                                T => 0,
                                null => 1,
                            };
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            set { }
                        }

                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        private readonly T? _reference;

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant <see cref="Some"/> of type <typeparamref name="T"/>.
                        /// </summary>
                        /// <param name="some">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public Option(T? some)
                        {
                            Discriminator = 0;
                            _some = some;
                        }

                        /// <summary>
                        /// Initializes a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant None of type <see cref="System.ValueTuple"/>.
                        /// </summary>
                        /// <param name="one">The variant.</param>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public Option(System.ValueTuple one = default)
                        {
                            Discriminator = 1;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> is the variant <see cref="Some"/> of type <typeparamref name="T"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        public readonly bool IsSome
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, "Some")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 0;
                        }

                        /// <summary>
                        /// Gets the value determining if the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> is the variant None of type <see cref="System.ValueTuple"/>.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        public readonly bool IsNone
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, "Some")]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 1;
                        }

                        /// <summary>
                        /// Gets the <typeparamref name="T"/> variant.
                        /// </summary>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        public readonly T? Some
                        {
                            [global::System.Diagnostics.Contracts.PureAttribute]
                            [global::System.Runtime.CompilerServices.MethodImpl(256)]
                            get => Discriminator is 0 ? _some : default;
                        }

                        /// <summary>
                        /// Implicitly converts the <typeparamref name="T"/> parameter to the union.
                        /// </summary>
                        /// <param name="some">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="some"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>(T some)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>(some);

                        /// <summary>
                        /// Explicitly converts the union to the target type <typeparamref name="T"/>.
                        /// </summary>
                        /// <param name="x">The union to access its property.</param>
                        /// <returns>The getter of the union <paramref name="x"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static explicit operator T?(global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T> x)
                            => x.Some;

                        /// <summary>
                        /// Implicitly converts the <see cref="System.ValueTuple"/> parameter to the union.
                        /// </summary>
                        /// <param name="one">The parameter to pass onto the constructor.</param>
                        /// <returns>The union containing the parameter <paramref name="one"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static implicit operator global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>(System.ValueTuple one)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>(one);

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant <see cref="Some"/> of type <typeparamref name="T"/>.
                        /// </summary>
                        /// <param name="some">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="some"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T> OfSome(T? some)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>(some);

                        /// <summary>
                        /// Creates a new instance of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant None of type <see cref="System.ValueTuple"/>.
                        /// </summary>
                        /// <param name="one">The value to pass into the type.</param>
                        /// <returns>The union containing the parameter <paramref name="one"/>.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T> OfNone(System.ValueTuple one = default)
                            => new global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T>(one);

                        /// <summary>
                        /// Determines whether the left-hand side is equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator ==(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> left, Emik.SourceGenerators.Choices.Generated.Tests.Option<T> right)
                            => (left.Discriminator == right.Discriminator) && (left.Discriminator
                            switch
                            {
                                0 => false,
                                1 => true,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <summary>
                        /// Determines whether the left-hand side is unequal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is unequal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator !=(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> left, Emik.SourceGenerators.Choices.Generated.Tests.Option<T> right)
                            => !(left == right);

                        /// <summary>
                        /// Determines whether the left-hand side is greater than the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is greater than the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator >(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> left, Emik.SourceGenerators.Choices.Generated.Tests.Option<T> right)
                            => (left.Discriminator == right.Discriminator) && (left.Discriminator
                            switch
                            {
                                0 => false,
                                1 => true,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <summary>
                        /// Determines whether the left-hand side is greater than or equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is greater than or equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator >=(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> left, Emik.SourceGenerators.Choices.Generated.Tests.Option<T> right)
                            => left == right || left > right;

                        /// <summary>
                        /// Determines whether the left-hand side is less than the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is less than the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator <(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> left, Emik.SourceGenerators.Choices.Generated.Tests.Option<T> right)
                            => right > left;

                        /// <summary>
                        /// Determines whether the left-hand side is less than or equal to the right.
                        /// </summary>
                        /// <param name="left">The left-hand side.</param>
                        /// <param name="right">The right-hand side.</param>
                        /// <returns>
                        /// The value determining whether the parameter <paramref name="left"/>
                        /// is less than or equal to the parameter <paramref name="right"/>.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public static bool operator <=(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> left, Emik.SourceGenerators.Choices.Generated.Tests.Option<T> right)
                            => right >= left;

                        /// <inheritdoc cref="object.Equals(object)"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public override bool Equals(object? obj)
                            => obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T> x && Equals(x);

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly bool Equals(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> other)
                            => this == other;

                        /// <inheritdoc cref="IComparable.CompareTo(object)"/>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly int CompareTo(object? obj)
                            => obj is null ? 1 : obj is global::Emik.SourceGenerators.Choices.Generated.Tests.Option<T> x ? CompareTo(x) : -1;

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly int CompareTo(Emik.SourceGenerators.Choices.Generated.Tests.Option<T> other)
                            => Equals(other) ? 0 : -1;

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly override int GetHashCode()
                            => unchecked(Discriminator * 31) ^
                            (Discriminator switch
                            {
                                0 => _some!.GetHashCode(),
                                1 => 0,
                                _ => throw new global::System.InvalidOperationException(),
                            });

                        /// <inheritdoc />
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly override string ToString()
                            => Discriminator switch
                            {
                                0 => $"{nameof(Some)}({_some!})",
                                1 => "None",
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <summary>
                        /// Invokes the callback based on current variance.
                        /// </summary>
                        /// <param name="onSome">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant <see cref="Some"/> of type <typeparamref name="T"/> is held.</param>
                        /// <param name="onNone">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant None of type <see cref="System.ValueTuple"/> is held.</param>
                        /// <returns>Itself.</returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly Emik.SourceGenerators.Choices.Generated.Tests.Option<T> Map(
                            global::System.Action<T?>? onSome = null,
                            global::System.Action? onNone = null
                        )
                        {
                            switch (Discriminator)
                            {
                                case 0:
                                    onSome?.Invoke(_some!);
                                    return this;
                                case 1:
                                    onNone?.Invoke();
                                    return this;
                                default: throw new global::System.InvalidOperationException();
                            }
                        }

                        /// <summary>
                        /// Maps each variant to <typeparamref name="TMappingResult"/>.
                        /// </summary>
                        /// <typeparam name="TMappingResult">The resulting type from the mapping.</typeparam>
                        /// <param name="onSome">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant <see cref="Some"/> of type <typeparamref name="T"/> is held.</param>
                        /// <param name="onNone">The callback to use when the contract of the <see cref="Emik.SourceGenerators.Choices.Generated.Tests.Option{T}"/> struct with the variant None of type <see cref="System.ValueTuple"/> is held.</param>
                        /// <returns>
                        /// The resulting value from one of the parameters based on the current state of the object.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly TMappingResult Map<TMappingResult>(
                            global::System.Func<T?, TMappingResult> onSome,
                            global::System.Func<TMappingResult> onNone
                        )
                            => Discriminator
                            switch
                            {
                                0 => onSome(_some!),
                                1 => onNone(),
                                _ => throw new global::System.InvalidOperationException(),
                            };

                        /// <summary>
                        /// Gets the underlying value.
                        /// </summary>
                        /// <returns>
                        /// The underlying value from this instance.
                        /// </returns>
                        [global::System.CodeDom.Compiler.GeneratedCode("Emik.SourceGenerators.Choices", "1.3.2.0")]
                        [global::System.Diagnostics.Contracts.PureAttribute]
                        [global::System.Runtime.CompilerServices.MethodImpl(256)]
                        public readonly T? GetUnderlyingValue()
                            => (T?)_reference!;
                    }
                }
            }
        }
    }
}

Contribute

Issues and pull requests are welcome to help this repository be the best it can be.

License

This repository falls under the MPL-2 license.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.0 147 9/30/2024
1.3.3 98 9/24/2024
1.3.2 105 9/6/2024
1.3.1 105 9/5/2024
1.3.0 129 8/11/2024
1.2.1 106 7/8/2024
1.2.0 315 11/12/2023
1.1.1 199 11/4/2023
1.1.0 250 11/4/2023
1.0.4 270 11/1/2023
1.0.3 208 10/31/2023
1.0.2 270 10/26/2023
1.0.1 228 10/23/2023
1.0.0 243 10/22/2023