Updating my mobile code libraries from ADAL (Azure Active Directory Authentication Library) to MSAL (Microsoft Authentication Library) was supposed to be a breeze. I thought I was simply swapping out ADAL for MSAL, but nope - the universe (and Microsoft) had other plans. I got an exception thrown in my face, informing me that my once trusty mobile app could no longer be a Confidential Client. Microsoft has spoken, and they don't trust mobile apps to keep secrets safe.
In the last couple of years, programming in .NET (.NET Core,
Xamarin, MAUI) is multi-targeting different frameworks or
platforms (NETCOREAPP, NET4, Windows, Android, iOS, . . .) and
conditional compilation is used more than ever. By inertia, many
of us who switched from C++ to C# continue to use preprocessor
directives to control conditional compilation(#if - #endif
).
.NET is offering another approach that is in some cases a cleaner
option.
After switching to .NET 6 and getting some warnings related to dereferencing nullable types I got an idea to write a complete article about nullable in C#. If you are someone who stopped learning about nullable after C#2 and introduction of nullable value types, this is the right article for you. It will show you all features related to nullable types and references up to and including C#10.
With ASP.NET Core 2.0 we got Razor Pages. I can only guess that this is only the first step of making something smarter then just “let’s go back to the time when we encouraged people to shove data, logic and DB access to one code-behind file”. What if this is just beginning and the next step is introduction of observables and automatic propagation of changes like in real MVVM?
Remember boring polymorphism examples where Circle
and Square
are derived from Shape
and
each one override Draw
method? This works well if
you are dealing with classes. What if you just have simple values
and no inheritance is possible?
New C#7 extended existing is
and switch
language constructs to check if item is of the certain "shape". Now
you can execute different code according to "shape" of the tested
item (similar to polymorphism).