public static ObservableCollection<DineOption> ConvertOptionToObject(string selectHtml) { ObservableCollection<DineOption> options = new ObservableCollection<DineOption>(); MatchCollection mc = Regex.Matches(selectHtml, "(<option[^v]*value=['\"]([^'\"]*)['\"][^>]*>)([^<]*)</option>", RegexOptions.Singleline & RegexOptions.IgnoreCase); foreach (Match item in mc) { if (!item.Groups[2].Value.Contains("disabled")) { DineOption newOption = new DineOption() { id = item.Groups[2].Value, name = item.Groups[3].Value }; options.Add(newOption); } } return options; }
public static ObservableCollection <DineOption> ConvertOptionToObject(string selectHtml) { ObservableCollection <DineOption> options = new ObservableCollection <DineOption>(); MatchCollection mc = Regex.Matches(selectHtml, "(<option[^v]*value=['\"]([^'\"]*)['\"][^>]*>)([^<]*)</option>", RegexOptions.Singleline & RegexOptions.IgnoreCase); foreach (Match item in mc) { if (!item.Groups[2].Value.Contains("disabled")) { DineOption newOption = new DineOption() { id = item.Groups[2].Value, name = item.Groups[3].Value }; options.Add(newOption); } } return(options); }