locked
C# 8 Coalescing operator / Switch expression possible bug RRS feed

  • Question

  •     public static string CombineElements(Element first, Element second, bool combine) =>
    
                (first, second, combine ??= true) switch
                {               
                    (Element.Fire, Element.Water, false) when combine = true => "You have created steam."
                    (Element.Water, Element.Fire, false) when combine = true => "You have done nothing."
    
                }

    In the code above, when trying to insert the null coalescing operator, Visual Studio preview crashes gracefully. 

    .Net I'm using is 4.8.03761, 

    VS version : 16.4.0 Preview 6.0

    Tuesday, December 3, 2019 3:38 PM