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.
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: