// create a polyline
List<Coordinate2D> coords = new List<Coordinate2D>
{
new Coordinate2D(0, 0),
new Coordinate2D(0, 1),
new Coordinate2D(1, 1),
new Coordinate2D(1, 0)
};
Polyline polyline = PolylineBuilderEx.CreatePolyline(
coords, SpatialReferences.WGS84);
WkbExportFlags wkbExportFlags = WkbExportFlags.WkbExportDefaults;
WkbImportFlags wkbImportFlags = WkbImportFlags.WkbImportDefaults;
// export and import
byte[] buffer = GeometryEngine.Instance.ExportToWKB(wkbExportFlags, polyline);
Geometry geometry = GeometryEngine.Instance.ImportFromWKB(
wkbImportFlags, buffer, SpatialReferences.WGS84);
Polyline importPolyline = geometry as Polyline;
// alternatively, determine the size for the buffer
int bufferSize = GeometryEngine.Instance.GetWKBSize(wkbExportFlags, polyline);
buffer = new byte[bufferSize];
// export
bufferSize = GeometryEngine.Instance.ExportToWKB(
wkbExportFlags, polyline, ref buffer);
// import
importPolyline = GeometryEngine.Instance.ImportFromWKB(
wkbImportFlags, buffer, SpatialReferences.WGS84) as Polyline;