Exemplo n.º 1
0
        public void InterpolatedStringImplicitConversion()
        {
            var            number = 54;
            ImplicitString str    = $"{number}";

            AssertTrue(str is ImplicitString);
        }
Exemplo n.º 2
0
        public static string SwitchOverImplicitString(ImplicitString s)
        {
            // we emit an explicit cast, because the rules used by the C# compiler are counter-intuitive:
            // The C# compiler does *not* take the type of the switch labels into account at all.
            switch ((string)s)
            {
            case "First case":
                return("Text1");

            case "Second case":
                return("Text2");

            case "Third case":
                return("Text3");

            case "Fourth case":
                return("Text4");

            case "Fifth case":
                return("Text5");

            case "Sixth case":
                return("Text6");

            case "Seventh case":
                return("Text7");

            case "Eighth case":
                return("Text8");

            case "Ninth case":
                return("Text9");

            case "Tenth case":
                return("Text10");

            case "Eleventh case":
                return("Text11");

            default:
                return("Default");
            }
        }