C# 7.0 Pattern Matching. Part1

1
Comments
C# 7.0 Pattern Matching. Part1

Great news! You can already try new C# 7.0 features. All you need is Visual Studio 15 Preview. Let's start! Today we are going to talk about Pattern Matching and will look under the hood of this nice feature. Unfortunately, it is only partly available in VS 15. So we need to wait until next release. Or you can try to get latest Roslyn from GitHub. is operator The is operator is extended to test an expression against a pattern. With that you can replace this: object obj = "Hello, World!...

Read further...

C# 7.0 Local Functions

10
Comments
C# 7.0 Local Functions

C# 7.0 is coming! Even 6.0 is not released yet, you can already try new C# 7.0 features. To do that you need: Visual Studio 15 preview Set __DEMO__ and __DEMO_EXPERIMENTAL__ as Conditional compilation symbol in project settings. Not all of the new features available in current preview, but you can already play with some of them. But today we gonna look closer at Local Functions private static void Main(string[] args) { int LocalFunction(int arg) { return 42 * arg; } Console.WriteLine(LocalFuncti...

Read further...