[C#] Concurrency cheat sheet

The .NET Framework provides a ridiculous number of solutions to deal with concurrency. You probably know the lock statement or the ManualResetEvent class, but you'll see that there are many more options. Life is always easier when you choose the appropriate tool, so you'd better know what's available. This article…

READ MORE

[WPF] Convert binding errors into exceptions

If you've done a bit of XAML in your life, you may have seen that the WPF engine has a big tendency to swallow errors that happens in the bindings. Ignored binding errors To illustrate the issue, let's start with a simple example: <Label Content="{Binding UserName}" /> This…

READ MORE

[C#] I wish I knew : Stopwatch.StartNew()

I've been a professional C# developer for years now, but I'm still discovering trivial stuffs. In "I wish I knew", I describe a feature that I missed. When you need to measure the performance of a C# program, you have basically two solutions: either use a profiler or add instrumentation…

READ MORE

[C#] I wish I knew : RealProxy

I've been a professional C# developer for years now, but I'm still discovering trivial stuffs. In "I wish I knew", I describe a feature that I missed. The Gang Of Four defined a lot of design patterns. Among them is one that I use quite often: the Proxy pattern. For…

READ MORE

[C#] I wish I knew : BitConverter

I've been a professional C# developer for years now, but I'm still discovering trivial stuffs. In "I wish I knew", I describe a feature that I missed. In my programmer's life, I encountered a lot of situations where I needed to log the content of a buffer. In that case,…

READ MORE

[C#] I wish I knew : SafeHandle

I've been a professional C# developer for years now, but I'm still discovering trivial stuffs. In "I wish I knew", I describe a feature that I missed. Today, we'll see how to use a SafeHandle instead of implementing a finalizer. Before starting, let's define an imaginary unmanaged API: static class…

READ MORE

[WPF/MVVM] How to deal with fast changing properties

In this article, I will describe a problem which happens in a WPF/MVVM application when the Model is updated at a very high frequency. It happened to me while implementing a Model handling a lot of values coming from instruments and I wanted to display the current values, even…

READ MORE