Converting Strings to .NET Objects – IParsable and ISpanParsable

Converting Strings to .NET Objects – IParsable and ISpanParsable

A new feature of C# 11 allows abstract static members with interfaces. This makes it possible to define class methods to be used as a contract with a generic class implementation, e.g. using + and – operators. With .NET 7, numeric types implement many new interfaces. This C# 11 feature is not only about math! The new IParsable and ISpanParsable interfaces allow creating objects from strings. As these interfaces can be used with constraints in generic types, parsing strings to create objects is now an easy task with generic implementations. This article shows implementing both the string and the Span version of the parse interfaces and using them with generic types. Continue reading Converting Strings to .NET Objects – IParsable and ISpanParsable

<strong>What’s the SynchronizationContext used for?</strong>

What’s the SynchronizationContext used for?

Creating Windows applications, UI controls are bound to the UI thread. .NET made it to different iterations with different patterns dealing with asynchronous programming. .NET 4.0 introduced the Task Parallel Library (TPL) and C# 5 added the async and await keywords. Together with these enhancements of .NET, and the synchronization context, invoking methods that make use of different threads has becoming a lot easier. Continue reading What’s the SynchronizationContext used for?

Professional C# and .NET – 2021 Edition

Professional C# and .NET – 2021 Edition

The new edition of my book is available – covering .NET, C#, WinUI, ASP.NET Core, EF Core, and more! Compared to the previous edition, it not only covers the newest editions of C# and .NET, you don’t have to carry a book with 1500 pages – the number of pages have been reduced – but I made sure that all the important topics are covered, you shouldn’t miss anything important topics needed to develop applications with .NET, C#, and Microsoft Azure. Continue reading Professional C# and .NET – 2021 Edition