Hello, I try to refactor this
I try to iterate like this,
but have no result.
C#:
var collection = new List<ShowOfCurrentEnum>();
foreach (var dealStatus in (DealStatuses[])Enum.GetValues(typeof(DealStatuses)))
{
var showCurrentEnum = new ShowOfCurrentEnum
{
Description = dealStatus.GetEnumDescription(),
IndexValue = (int) dealStatus,
NameOfValue = dealStatus.ToString()
};
collection.Add(showCurrentEnum);
}
I try to iterate like this,
C#:
var myNewCollection = (DealStatuses[]) Enum.GetValues(typeof(DealStatuses)).Select(fg=>
new ShowOfCurrentEnum()
{
Description = fg.GetEnumDescription(),
IndexValue = (int)fg,
NameOfValue = fg.ToString()
}).ToList();
but have no result.