private static SearchCriteria Parse(string criteria) { SearchCriteria result = new SearchCriteria(); if (criteria.Length == 0) { return(result); } var searchCriteriaElements = SearchCriteriaElement.Parse(criteria); for (int i = 0; i < 4; i++) { if (searchCriteriaElements.Length > i) { result.elements[i] = searchCriteriaElements[i]; } else { result.elements[i].Enabled = false; } } if (result.Segment.Length == 0 && !result.elements[0].Skip) { throw new ArgumentException("Segment type or wildcard expected"); } return(result); }