Sign in

My blog about all things related to software development.

I recently had to solve the problem of converting strings into enums in C#. There are a few different solutions you can implement depending on your requirements. This article aims to show you some of these solutions and when to use each one.

Method 1: Enum.Parse Method

This is probably one of the simplest methods as it is built into .NET. It allows you to convert a string into an enum by matching the given string to the enum item with the same name and then returning that enum item.

It’s important to note that the string comparison is case-sensitive by default but can…

A while back I wrote an article describing how to create custom configuration sections in the App.config file in .NET. This is by far the most popular blog post I have posted on this website as it has consistently outperformed all of my other posts:

I decided to write this follow-up post describing how you can use Config.Net for configurations in your .NET (and .NET Core) applications for a few reasons:

  • It works with .NET Core
    With .NET Core, Microsoft moved configuration for applications to the appsettings.json file instead of an XML-based App.config file. This means that the App.config approach described…

Ivan Kahl

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store