How to retrieve dates as UTC in SQLite

SQLite is a nice in-process database engine: it’s very lightweight, doesn’t require any server or configuration, and runs on all platforms. There is even an official ADO.NET provider that’s very well made. However, if you store dates as UTC with this provider, you will probably encounter a serious issue: even though the date is properly […]

Async and cancellation support for wait handles

The .NET framework comes with a number of low-level synchronization primitives. The most commonly used are collectively known as “wait handles”, and inherit the WaitHandle class: Semaphore, Mutex, AutoResetEvent and ManualResetEvent. These classes have been there since at least .NET 2.0 (1.1 for some of them), but they haven’t evolved much since they were introduced, […]

C# Puzzle 1

I love to solve C# puzzles; I think it’s a great way to gain a deep understanding of the language. And besides, it’s fun! I just came up with this one: What do you think this code prints? Can you be sure? Post your answer in the comments! I’ll try to post more puzzles in […]