Check for elevated rights in .NET 8

07/12/2022

A recent API was added to the framework under the name "Add API to check if process had administrator privileges", which adds this API to the framework itself.

And it is fairly simple:

var hasPrivilegedRights = Environment.IsPrivilegedProcess;

Yes, that is all. The new call lives in the System.Environment class. That works independently of the underlying OS (as long as the underlying OS supports the .NET runtime). Currently (as of today - 7. December 2022) there is no API that grants you privileged rights nor an API that drops them. But there are ideas and smaller proposals for that. So let's see what the future brings.

How does List work under the hood in .NET?

A List is one of the most used data types in .NET. You can dynamically add elements without taking care of how that happens. But do you know what is going on under the hood?

Marking API's as obsolete or as experimental

Often times your API in your program or library evolves. So you will need a mechanism of telling that a specific API (an interface or just a simple method call) is obsolete and might be not there anymore in the next major version.

Also it can happen that you have a preview version of a API, which might not be rock-stable and the API-surface might change. How do we indicate that to the user?

Time abstraction in .NET 8

With the upcoming release of .NET, the team introduced an abstraction of time itself. That can bring you major benefits especially if you have to test scenarios where time is a crucial part! Until now, you had to create your own wrapper. This, of course, makes integration with 3rd party libraries tricky.

An error has occurred. This application may no longer respond until reloaded. Reload x