Tools: String Manipulations Find Dupes My IP Json Formatter Lorem Ipsum More...
Discussion Options
ajax animation

.NET: Create Dictionary from Enums | Convert Enum to Dictionary

5/17/2018 11:39:51 AM by: CodeLocker

Convert a .NET enum to a dictionary (Dictionary<int, string>);

View Copy: Content Copied
var enumDictionary = Enum.GetValues(typeof(MyEnum)).Cast<int>().ToDictionary(e => e, e => Enum.GetName(typeof(MyEnum), e));
Copy: Content Copied
ajax animation
×

Get Coding

Store your first code or add more code to your collection.
You must login to report abuse. ×