>>Select(val=>new KeyValuePair<string, string> (val.ListItemValue.ToString(), val.ListItemText)).ToList(); >>>>Testing now.
>>typeCriteria.PossibleValues = EnumUtilities.EnumToEnumViewModel<TemplateTypes>(selectEnumValue: TemplateTypes.Pass, omitEnumValue: TemplateTypes.NotSpecified);>>
>>Error 1 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<SysManager.Common.Models.EnumViewModel>' to 'System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string,string>>'. An explicit conversion exists (are you missing a cast?) c:\_siriusware\main\sysmanager\sysmanager.web\areas\items\controllers\templatesapicontroller.cs 73 47 SysManager.Web >>>>
>>public class EnumViewModel >> { >> public virtual bool Selected { get; set; } >> public virtual string ListItemText { get; set; } >> public virtual Int32 ListItemValue { get; set; } >> }>>
List<KeyValuePair<Int32, EnumViewModel>> result =
> list.ConvertAll(x => new KeyValuePair<int, EnumViewModel>(x.ListItemValue, x));
Thanks. I used the syntax I posted above and it also worked. I needed KeyValuePair of string, string where the first is ListItemValue.ToString() and the second is ListItemText.