Snippets Collections
//Is it too early to learn about switch pattern matching? 
//Only available in C# v8.0 and newer (.Net Core 3.x or .Net 5.0 and newer)

    Public static double BasicOp(char op, double a, double b) => op switch
            '*' => a * b,
            '+' => a + b,
            // Other ops 
            _ => 0

//*Edit - fixed some syntax errors

Mon Jul 25 2022 18:03:20 GMT+0000 (UTC)

#c# #v8

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension