I have an array of enums that I need to convert to an anonymous object with a property for each enum.
For example:
public enum MyColors
{
Red,
Blue,
Green,
}
What I need is
new { MyColors.Red, MyColors.Blue}
I have a List
var colorList = new List<MyColors> {MyColors.Red, MyColors.Blue};
There a shorthand way of creating an anonymous object with every element in my list as a property?
Not looking for ExpandoObject