When you need to construct a LineString object from C# you can use the SqlGeographyBuilder class located in the Microsoft.SqlServer.Types dll to help you do it. This is how:
var points = ...;//a list of points that you want to add; var firstPoint = points[0]; var builder = new SqlGeographyBuilder(); builder.SetSrid(4326); builder.BeginGeography(OpenGisGeographyType.LineString); builder.BeginFigure(firstPoint.Lat, firstPoint.Lng); points.GetRange(1, points.Count - 1).ForEach(point => builder.AddLine(point.Lat, point.Lng)); builder.EndFigure(); builder.EndGeography(); var lineString = builder.ConstructedGeography;
Cheers!