Skip to main content

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 […]

C# – Upgrade Your Solution To .Net

upgrade .Net Framework to .Net

This article will talk about how you can easily upgrade your .Net Framework solution to .Net 5 (6, Core, Standard). Microsoft released a simple dotnet script to do this painful task for you. Currently the tool supports the following .NET Framework app types: .NET Framework Windows Forms apps .NET Framework WPF apps .NET Framework ASP.NET […]

WPF – ContentControl and TemplateSelector

Content_selection

Here is a simple example about the ContentControl and the TemplateSelector. This is really useful when you have a single model that can be represented on the UI in different ways depending on an enum for example. This will be the final result in the UI while using the same model: Let’s start with our […]

C# – BDD Tests with xBehave and xUnit

given-when-then

In this post we will see the basics of BDD with xUnit and xBehave. But not only! If you don’t know what are: BDD, Gherkin, integration tests, Cucumber, SpecFlow, xUnit or xBehave, read the following sections. Otherwise, just skip straight to a simple example of an integration test with C# based on xBehave and xUnit. […]

C# Multiply all elements from a list

mulitply aggregate

Here is a really short and simple example of how multiply all elements from a list with C#. The bad way and the good way. The bad way to multiply items from a list with C# There is actually nothing bad about it. It is just not sexy and doesn’t use LINQ. But to be […]

Unzip file using C#

unzip

Extracting the content of a ZIP file is really common. And here is a simple example of how to do it with C# using ZipFile and SharpZipLib. If you are using .Net Framework 4.6.0 or up you can use System.IO.Compression.ZipFile from Microsoft. But if you are lower than 4.6 then you can use SharpZipLib from […]

C# – FTP With ComponentPro

FTP

ComponentPro is a professional suite of libraries for FTP, sFTP and document manipulations (Word, Excel, PDF, …). Here is a simple example of how to use it with (s)FTP.

How to use Font Icons

font-awesome

What is the issue with images? The problem with images is that if you try to zoom in, the quality starts to be really bad (ugly pixels) without even talking about the size of it. The best way to display nice icons in your app or website is to use Font Icons. Like that you […]

UWP – How to get the close app event

close-event

Basically, what we want here is to be able to catch the close event of our UWP app. We could go further and ask the users if they want to save their changes before the Exit. In the App.xaml.cs: Here, it is important to put the CloseRequested event before the Activate of the View. Then, add the code for […]

UWP – UI Thread and Multiple Views

UIThread UWP Dispatcher

What is “multiple view” in UWP? In UWP, your “main” application can open a new – separated – view. Here is a link from the Microsoft website. When should you use multiple views? In many cases it is useful to be able to open multiple views: – An email app that lets users view a […]