/// <summary> /// Synchronously executes the <see cref="T:Microsoft.AspNet.Razor.TagHelpers.TagHelper" /> with the given /// <paramref name="context" /> and /// <paramref name="output" />. /// </summary> /// <param name="context">Contains information associated with the current HTML tag.</param> /// <param name="output">A stateful HTML element used to generate an HTML tag.</param> public override void Process(TagHelperContext context, TagHelperOutput output) { // Get list and convert to array (avoiding duplicate enumration) var items = GenerateListForEnumType().ToArray(); // Get value var selectedValue = GetValueForMember(EnumValue.GetMember()); // Set selected Item items.First(i => i.Value == selectedValue).Selected = true; // Append list items output.PostContent.AppendHtml(HtmlGeneratorHelper.GenerateGroupsAndOptions(null, items)); }