Skip to main content

C# – Newtonsoft JSON serialization – String containing a DateTime

string serialization

Newtonsoft is known for their JSON library. Very useful and used everywhere, even for serialization of complex object in REST, NServicebus, … But in some specific cases, the behavior of this serializer / deserializer can be weird. My case here is about passing a String containing a DateTime, like: “2023-10-03T10:00:00Z”. Which is a UTC DateTime […]

How to fix RDP freezing on “Please Wait” screen

rdp please wait

Having to work on a remote machine every day, I’ve encountered a few times a really annoying issue: when you launch the MSTSC application and once connected to the remote machine, it says “Please Wait” forever. Especially when you don’t have admin rights on the machine you are on, there is not a lot you […]

C# – Split String with String delimiter

split string

The Split method from System.String doesn’t provide a simple way of splitting a String with a String delimiter. Instead it proposes to split it with a Char. Useful, but not enough… This is the way for splitting a String based on a String delimiter: Otherwise, if you just want to split the String based on […]

WPF – ShowDialog on top of the Main Window


Hi devz, While using a Microsoft.Win32 Dialog (OpenDialog or SaveDialog), it is possible that it will be opened behind the Main Window. So a good way to go back on that dialog is to use the ALT+TAB combo. But not really intuitive for the end user. The best way would be that this dialog is […]

C# – Open an already opened file


Let’s say you want to open an Excel file by code but this Excel file is already opened by another user on another machine on a file share… You might encounter this issue: The process cannot access the file because it is being used by another process. But you still can open this file in […]

C# – Parse String Hour to TimeSpan or DateTime


Converting a String to something else can always be tricky. Especially if that String is about time. The thing is the fact that there are many ways to represent time and that can actually depend on the country you are. 6 PM, 6.00 PM, 06.00, 06:00, 18:00, 18h00, 18H00, they could be all the same. […]

WPF – OpenFileDialog


This is a simple example to have an OpenFileDialog (a premade view done by Windows to select a file to open) with WPF, filtering on XLSX file: In this case the InitialDirectory will always exist because it is the Desktop of the current user. But you have to know that if the targeted InitialDirectory doesn’t […]

C# – AutoMapper Configuration Tutorial

automapper logo

What is AutoMapper? AutoMapper is a C# library which allows to do the mapping automatically between two similar objects. Typically really useful to map for example a domain model to a DTO (Data Transfer Object) or from a UI model to other layers of your code. Why should you use AutoMapper? Of course you always […]

C# – How to use Serilog


There are many log libraries on NuGet, but I would say the 3 most known ones are NLog, Log4Net and Serilog. This article will focus on Serilog with a simple example of how to start with it. Why should you use Serilog? Serilog is a powerful library allowing you to create logs for your application […]

C# – Read Settings from the AppSettings.json

appsettings json

You might be used to the good old web.config or app.config file. But if you upgrade your solution to something a bit more modern like .Net 5, then it will be transformed to appsettings.json. Here are some tips about how to use the appsettings.json. The app.config file was stored as an XML file. So you […]