[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 : catch unhandled exceptions

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. Here is a very common pattern: I'm writing an application and I want a custom dialog box to appear in case an unhandled…

READ MORE

[C#] I wish I knew : Nullable<T>.GetDefaultValue(T)

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. Given the following: struct T {} T? nullable; T fallback; I always though the only alternative to this: T value = nullable.HasValue ? nullable.Value…

READ MORE