News for hackers. Stuff that matters.
Re:How many keywords I can fit into a single C# expression? by vermorel on Thursday February 07, 2019 @02:10AM (#19103591)
Well, C# 8 will be having something much nicer syntax actually:

        void foo()
        {
            object pi = 3.14d;

            Console.WriteLine(pi switch 
            {
                int i => "pi is an int of value " + i,
                float f => "pi is a float of value " + f,
                double d => "pi is a double of value " + d,
                _ => "pi is of an unknown type.";
            });
        }
Check-out https://neelbhatt.com/2018/05/19/c-8-0-expected-features-par... Cheers!

There are no comments on this comment yet.