Change your habits: Modern techniques for modern C# - Bill Wagner
Video Statistics and Information
Channel: NDC Conferences
Views: 211,569
Rating: undefined out of 5
Keywords: Bill Wagner, Languages, .NET, C# 8.0, .NET Core 3.0, NDC, London, 2020
Id: aUbXGs7YTGo
Channel Id: undefined
Length: 55min 45sec (3345 seconds)
Published: Mon Feb 17 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Bill Wagner is a developer of the C# language (Wikipedia))
Tuplet assignment
is equivalent to:
This makes sense for two, or three fields, for more becomes less readable.
Tuplet comparison (lets pretend we can compare double values this way)
Can become:
Swap variables with tuplets:
Can become:
Readonly structs
Annotating readonly on a struct makes sure the compiler does not copy the value of a struct. It has some performance benefits and pitfalls.
Pattern matching:
Can become:
Throwing exceptions using a null coalescing operator
Throw null exceptions when not assigning something, assign to a discard. Bill would like this kind of behavior to be the future standard way of doing this.
Turbo switching: Pattern matching + tuples + switch The example given is a bit complex to summarize. I think an easier example is given in this blog post
Date and time math: Don't do it yourself. Use TimeSpan and DateTime for all your adding and subtracting needs, because dates are a mess.
Good video, I think I'll start using a few of those.
Timestamps for others, if you want to skip to the main points:
TL;DR
New Habits
Some interesting stuff here. I like the tuple swap too.
Thanks for sharing, that was pretty useful, I loved the pattern matching with the switch statement, really amazing, the explanation about it starts at 38:00 in the video, it was gold!
I saw this a couple of days ago. Itβs a great lecture.
!arweavethis