ArcGIS Pro 2.6 API Reference Guide
InsertGeometries Method
Example 

ArcGIS.Core.Geometry Namespace > GeometryBagBuilder Class : InsertGeometries Method
0 based index. Specify 0 to insert at the beginning. Specify CountGeometries or -1 to insert at the end.
The geometry to insert.
Inserts the given list of geometries before the specified index. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void InsertGeometries( 
   int index,
   IEnumerable<Geometry> geometries
)
Public Sub InsertGeometries( _
   ByVal index As Integer, _
   ByVal geometries As IEnumerable(Of Geometry) _
) 

Parameters

index
0 based index. Specify 0 to insert at the beginning. Specify CountGeometries or -1 to insert at the end.
geometries
The geometry to insert.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
geometries is null.
A geometry in geometries is null. You cannot insert a null geometry into GeometryBag.
A geometry in geometries is GeometryBag. You cannot insert a GeometryBag into another GeometryBag.
index must be less than the number of geometries in the builder or equal to -1.
Remarks
Specifying -1 for the index is equivalent to AddGeometries.

An Envelope is converted to a Polygon when it is inserted into a GeometryBag. As a result, when retrieving an Envelope from a GeometryBag, it will be a Polygon.

Example
MapPoint point = MapPointBuilder.CreateMapPoint(10, 20);
List<Coordinate2D> coords = new List<Coordinate2D>() { new Coordinate2D(50, 60), new Coordinate2D(-120, -70), new Coordinate2D(40, 60) };
Multipoint multipoint = MultipointBuilder.CreateMultipoint(coords, SpatialReferences.WebMercator);
Polyline polyline = PolylineBuilder.CreatePolyline(coords);

string json = "{\"rings\":[[[0,0],[0,1],[1,1],[1,0],[0,0]],[[3,0],[3,1],[4,1],[4,0],[3,0]]]}";
Polygon polygon = PolygonBuilder.FromJson(json);

var geometries = new List<Geometry>() { point, multipoint, polyline, polygon };

// Builder constructors need to run on the MCT.
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
  using (var builder = new GeometryBagBuilder(SpatialReferences.WGS84))
  {
    // builder.CountGeometries = 0

    builder.AddGeometries(geometries);
    // builder.CountGeometries = 4

    GeometryBag geomBag = builder.ToGeometry();
    // bag.PartCount = 4    (point, multipoint, polyline, polygon)

    geometries = new List<Geometry>() { point, polyline };
    builder.InsertGeometries(1, geometries);
    // builder.CountGeometries = 6
    geomBag = builder.ToGeometry();
    // bag.PartCount = 6    (point, point, polyline, multipoint, polyline, polygon)
  }
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

GeometryBagBuilder Class
GeometryBagBuilder Members