Presentation from .NET Conf Thailand 2020
See the stream here: https://www.youtube.com/watch?v=-iQkrvBBcTA
What's new in C# 9.0.pdf- slides (only two) from the presentation.What's new in C#.ipynb- Jupyter notebook of new C# 9.0 features (uses dotnet interactive).HelloWorld- A visual studio solution used during the presentation.
- https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9
- https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/
- I heard will soon have
record classandrecord struct?- Maybe! In C# 9, we just have
recordwhich meansrecord class. In future versions of C# (e.g. 10) we might get newrecord classandrecord structsyntax; andrecordwould continue to be a shorthand forrecord class.
- Maybe! In C# 9, we just have
- Do we get C# 9 automatically when we create a .Net 5.0 project or do we need to do something else?
- Yes! We get C# 9 automatically when we create a .NET 5.0 project.
- Is
Customer == nullequal toCustomer is null? Which one executes quicker?- They're not quite equal. If
Customerimplements an operator overload for equality,Customer == nullwill call that overload. The pattern matching approach,Customer is null, is guaranteed to do a real null check, regardless of any operator overload. - For this reason, since C# 7, the recommended way to null checks is to use
Customer is null. In the absence of overloads, the performance is identical
- They're not quite equal. If