Show / Hide Table of Contents

Constructor LineSegment

LineSegment(MapPoint, MapPoint)

Initializes a new instance of the LineSegment class based on two points.

Declaration
public LineSegment(MapPoint startPoint, MapPoint endPoint)
Parameters
Type Name Description
MapPoint startPoint

The start point.

MapPoint endPoint

The end point.

Remarks

Use this constructor to create a line segment representing a straight line between two points.

If both points have a SpatialReference set, they must be equal.

Exceptions
Type Condition
ArgumentException

Indicates that the SpatialReference of both supplied MapPoint values are non-null and differ.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

LineSegment(MapPoint, MapPoint, SpatialReference?)

Initializes a new instance of the LineSegment class based on two points and a spatial reference.

Declaration
public LineSegment(MapPoint startPoint, MapPoint endPoint, SpatialReference? spatialReference)
Parameters
Type Name Description
MapPoint startPoint

The start point.

MapPoint endPoint

The end point.

SpatialReference spatialReference

A spatial reference

Remarks

Use this constructor to create a line segment representing a straight line between two points. The spatialReference parameter is used if the points have a null SpatialReference. If more than one spatial reference is supplied they must all be equal.

Exceptions
Type Condition
ArgumentException

Indicates that the spatial references of non-null MapPoint and SpatialReference parameters differ.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

LineSegment(double, double, double, double)

Initializes a new instance of the LineSegment class on coordinates

Declaration
public LineSegment(double xStart, double yStart, double xEnd, double yEnd)
Parameters
Type Name Description
double xStart

The X coordinate of start point.

double yStart

The Y coordinate of start point.

double xEnd

The X coordinate of end point.

double yEnd

The Y coordinate of end point.

Remarks

Use this constructor to create a line segment representing a straight line between two points.

Exceptions
Type Condition
ArcGISException

Empty geometry.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

LineSegment(double, double, double, double, SpatialReference?)

Initializes a new instance of the LineSegment class based on coordinates.

Declaration
public LineSegment(double xStart, double yStart, double xEnd, double yEnd, SpatialReference? spatialReference)
Parameters
Type Name Description
double xStart

The X coordinate of start point.

double yStart

The Y coordinate of start point.

double xEnd

The X coordinate of end point.

double yEnd

The Y coordinate of end point.

SpatialReference spatialReference

A spatial reference

Remarks

Use this constructor to create a line segment representing a straight line between two points. The spatialReference parameter is used if the point's have a null SpatialReference. If more than one spatial reference is supplied they must all be equal.

Exceptions
Type Condition
ArcGISException

Empty geometry.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

LineSegment(double, double, double, double, double, double)

Initializes a new instance of the LineSegment class based on 3D coordinates

Declaration
public LineSegment(double xStart, double yStart, double zStart, double xEnd, double yEnd, double zEnd)
Parameters
Type Name Description
double xStart

The X coordinate of start point.

double yStart

The Y coordinate of start point.

double zStart

The Z coordinate of start point.

double xEnd

The X coordinate of end point.

double yEnd

The Y coordinate of end point.

double zEnd

The Z coordinate of end point.

Remarks

Use this constructor to create a line segment representing a straight line between two points.

Exceptions
Type Condition
ArcGISException

Empty geometry.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

LineSegment(double, double, double, double, double, double, SpatialReference?)

Initializes a new instance of the LineSegment class based on 3D coordinates and a spatial reference.

Declaration
public LineSegment(double xStart, double yStart, double zStart, double xEnd, double yEnd, double zEnd, SpatialReference? spatialReference)
Parameters
Type Name Description
double xStart

The X coordinate of start point.

double yStart

The Y coordinate of start point.

double zStart

The Z coordinate of start point.

double xEnd

The X coordinate of end point.

double yEnd

The Y coordinate of end point.

double zEnd

The Z coordinate of end point.

SpatialReference spatialReference

A spatial reference

Remarks

Use this constructor to create a line segment representing a straight line between two points. The spatialReference parameter is used if the point's have a null SpatialReference. If more than one spatial reference is supplied they must all be equal.

Exceptions
Type Condition
ArcGISException

Empty geometry.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8
In this article
Provide feedback
Back to top Copyright © 2025 Esri.