private static ElementId ParseElementId(String singleElementValue) { ElementId elementId; if (ElementId.TryParse(singleElementValue, out elementId)) { return(elementId); } else { // Error - the option supplied could not be mapped to int. // TODO: consider logging this error later and handling results better. throw new Exception("String did not map to a usable element id"); } }
private static IList <ElementId> ParseElementIds(String elementsToExportValue) { String[] elements = elementsToExportValue.Split(';'); List <ElementId> ids = new List <ElementId>(); foreach (String element in elements) { ElementId elementId; if (ElementId.TryParse(element, out elementId)) { ids.Add(elementId); } else { // Error - the option supplied could not be mapped to int. // TODO: consider logging this error later and handling results better. throw new Exception("Substring " + element + " did not map to a usable element id"); } } return(ids); }