C#7 MeetUp with Mad Torgersen

C#7 MeetUp with Mad Torgersen post image

One of the best MeetUps in ages, covering the new features in C# version 7 and the plans for the future of the language.  Thanks to Marcus, Mads and Auckland Dot Net.

One of the cool new features of C#7 is pattern matching in case statements. It is important to understand that variables declared inside a case statement are available throughout that case statement, but not variables assigned in the head condition, which are only available within their area’s scope.

Mads provided an example which is shown in the photo below:.

Another interesting thing, that Mads demonstrated, which actually come in C#6 is nameof.  Using nameof(variable) will get a string with the name of the type of the variable.  This is handy in many situations like logging and exception handling where it is useful to know the name for the type of the variable.  You can read about it more here.

It was also interesting to me that the use of ref and structs is more efficient and helpful for high performance applications, the example given was graphic intensive interactive applications, however this is generally applicable and should be weighed against the cost of added complexity and maintainability.

The final point I’ll mention is that it is proposed that there will be point releases of the language in future.  Thus the cadence will increase and we can expect more features sooner rather than later.  One of these may be ‘readonly ref’ currently available, but in a new version could become a new keyword ‘in’  c.f. ‘out’. Really looking forward to that one!

It is the end of July and having started a new role with Softtech a few months ago the blog has been a tad light on new content while I’ve been highly focused getting up to speed there… Nonetheless do keep a lookout for some more posts, some dot net core, and even some new public apis, coming soon!

0 comments… add one

Leave a Comment