A fast way of converting C# enums to strings–and back again.

I recently needed a fast way of converting lots of enums to strings (and back again). I needed to do it very quickly. ‘Enum.Parse’ just wasn’t fast enough.

I discovered there was no ‘enum mapper’ in C#, so I knocked up this little class. It uses reflection just once when it comes across a new enum.

It’s compatible with .NET 3.5 too.

🙏🙏🙏

Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please 🦋 ping me on Bluesky! 🦋

Leave a comment

Comments are moderated, so there may be a short delays before you see it.

Published