Mads Torgersen writes:
With every new version of C# we strive for greater clarity and simplicity in common coding scenarios, and C# 9.0 is no exception. One particular focus this time is supporting terse and immutable representation of data shapes.
Source: C# 9.0 on the record | .NET Blog
In the previous post of this series, Dave Brock discussed the init-only features of C# 9, which allowed us to make individual properties immutable. That works great on a case-by-case basis, but the real power in leveraging C# immutability is when we can do this for custom types. This is where records shine.
This is the second post in a five-post series on C# 9 features in-depth.
Source: C# 9 Deep Dive: Records | Dave Brock
Source: Blazor’s Future: gRPC Is Key — Visual Studio Magazine
Probably the most impactful feature of C# 8.0 is Nullable Reference Types (NRTs). It lets you make the flow of nulls explicit in your code, and warns you when you don’t act according to intent. The NRT feature holds you to a higher standard on how you deal with nulls,
Source: Embracing nullable reference types | .NET Blog
System .Threading .Thread instance
||Expensive, not recommended
BeginXxx method with a user callback; calling
EndXxx inside that user callback
||Widely used, standard, recommended, support cancellation and continuation
||Widely used, recommended use as much as possible
||By calling Delegate’s
EndInvoke instance methods
||By subscribing to the appropriate event and calling the appropriate method
||Avoid use as much as possible, not recommended
System .Threading .Tasks .Task instance
|A specified task scheduler
||Recommended, supports all features of a thread pool pattern, and has many other features
async method and
|Task based pattern
||The new C# 5.0 asynchronous pattern
Read more in The Asynchronous Programming Models (C# 5.0 Series) at CodeProject
Try out Nullable Reference Types With the release of .NET Core 3.0 Preview 7, C# 8.0 is considered “feature complete”. That means that the biggest feature of them all, Nullable Reference Types, is also locked down behavior-wise for the .NET Core release.
Source: Try out Nullable Reference Types | .NET Blog
Rapidly create Shell Context Menu Extensions using .NET
Source: .NET Shell Extensions – Shell Context Menus – CodeProject
Converting nearly every type to another type in .NET
“.NET does not provide a generic way for conversions across all types. Even the base types are not handled the same way. And not all possible conversions across the base types are supported. We had a look at the different techniques and ended up with the
UniversalTypeConverter as a generic solution filling the gaps and with some useful options on top.
Maybe, it is a historical thing that
TypeConverter is not used on all types. But this is definitely the way to go if you want to provide your own types being convertible.”
Source: Universal Type Converter – CodeProject
Want to modernize your C# codebase? Let’s continue with methods.
Source: Modernize Your C# Code – Part II: Methods – CodeProject
Want to modernize your C# codebase? Let’s start with properties.
Source: Modernize Your C# Code – Part I: Properties – CodeProject