private static IEnumerable <Linestring> GetLineStrings([NotNull] IGeometry shape) { if (shape.GeometryType == esriGeometryType.esriGeometryMultiPatch) { var segments = QaGeometryUtils.GetSegments((IMultiPatch)shape); yield return(GetLineString(segments)); } else if (shape.GeometryType == esriGeometryType.esriGeometryPolygon || shape.GeometryType == esriGeometryType.esriGeometryPolyline) { foreach (var path in GetLinearizedPaths(shape)) { yield return(GeometryConversionUtils.GetLinestring(path)); } } else { throw new ArgumentException( $@"Unexpected geometry type: {shape.GeometryType}", nameof(shape)); } }