/// <summary> /// Initializes a new instance of the <see cref="Polygon" /> class. /// </summary> /// <param name="coordinates"> /// The linear rings with the first element in the array representing the exterior ring. /// Any subsequent elements represent interior rings (or holes). /// </param> public Polygon(IEnumerable <LineString> coordinates) { Coordinates = new ReadOnlyCollection <LineString>( coordinates?.ToArray() ?? throw new ArgumentNullException(nameof(coordinates))); if (Coordinates.Any(linearRing => !linearRing.IsLinearRing())) { throw new ArgumentException("All elements must be closed LineStrings with 4 or more positions" + " (see GeoJSON spec at 'https://tools.ietf.org/html/rfc7946#section-3.1.6').", nameof(coordinates)); } }