Session

The Time Traveller's Guide to .NET 8: Are you doing it right?

Are you using DateTime, DateTimeOffset, or timers in your code? Then you should be using the TimeProvider API introduced with .NET 8 going forward, even if you are still programming in earlier versions of .NET.

This talk will:

• Teach how to use the TimeProvider API and other time-based APIs in .NET that support it. It is not just about “UtcNow”, there is support for timers, time stamps, time zones, and other time-based APIs like Task.Delay that supports it.

• Dive into the design of TimeProvider API and cover the interesting and controversial choices that were made, e.g., why does it seemingly break with the “single responsibility principle” and other SOLID principles.

• Show how to control the progress of time deterministically during testing. Hint, you probably do not want to use a mocking library with TimeProvider.

• Discuss good practices and pitfalls when using a TimeProvider in both production- and test code.

Egil Hansen

Distinguished Developer at Delegate, Microsoft MVP, creator of bUnit and AngleSharp.Diffing.

Reykjavík, Iceland

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top