How to create a multipoint object from the vertices of a polyline

Creating a multipoint object from the vertices of a polyline

The following code example creates a multipoint with point elements being copies of the vertices of an existing polyline. It then offsets those elements five units to the right using one transformation method, then offsets them up another five units.
static void transformPoint(IPolyline polyline)throws Exception{
    IPointCollection polylinePoints = (IPointCollection)polyline;
    IGeometry multipoint = new Multipoint();

    IPointCollection multipointPoints = (IPointCollection)multipoint;

    //Add copies of the polyline vertices to the multipoint.

    IAffineTransformation2D affineTransformation = new AffineTransformation2D();
    affineTransformation.move(5, 0);

    ITransform2D transformee = (ITransform2D)multipoint;

    //Shift up by 5. 
    transformee.move(0, 5);

Development licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine