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 class
andrecord struct
?- Maybe! In C# 9, we just have
record
which meansrecord class
. In future versions of C# (e.g. 10) we might get newrecord class
andrecord struct
syntax; andrecord
would 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 == null
equal toCustomer is null
? Which one executes quicker?- They're not quite equal. If
Customer
implements an operator overload for equality,Customer == null
will 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