/// <summary> /// Creates an instance of an FilterItem object from a string. /// </summary> /// <param name="value">string to convert to object</param> /// <returns>FilterItem object</returns> public static FilterItem FromString(string value) { string[] values = value.Split(DELIMETER); var item = new FilterItem(); item.FilterType = FilterType.FromString(values[0]); item.Value = values[1]; item.ValueOption = (FilterType.ValueOptions)Enum.Parse(typeof(FilterType.ValueOptions), values[2]); item.ValueIgnoreCase = Convert.ToBoolean(values[3]); item.ValueSizeOption = values[4]; item.Enabled = Convert.ToBoolean(values[5]); return(item); }
/// <summary> /// Converts the given string to a list of FilterItems. /// </summary> /// <param name="value">string to convert</param> /// <returns>List of FilterItems</returns> public static List <FilterItem> ConvertStringToFilterItems(string value) { var list = new List <FilterItem>(); if (!string.IsNullOrEmpty(value)) { var values = value.Split(LIST_DELIMETER); foreach (string val in values) { list.Add(FilterItem.FromString(val)); } } return(list); }