I have solved this problem by using a simple approach. The general procedure is below:
1) Create a List<ESRI.ArcGIS.Geometry.IPoint> to collect all of points.
2) Create an object of ISegmentCollection path = new ESRI.ArcGIS.Geometry.PathClass();
3) Create a segment by entering 2 points (looping the List<ESRI.ArcGIS.Geometry.IPoint>)
4) Add the segment into the path.
object obj = Type.Missing;
for (int i = 1; i < pointsCollection.Count; i++) {
ILine pLine = CreateLine(pointsCollection[i - 1], pointsCollection);
path.AddSegment((ISegment)pLine, ref obj, ref obj);
}
private ILine CreateLine(IPoint ptA, IPoint ptB) {
ILine pLine = new Line();
pLine.PutCoords(ptA, ptB);
return pLine;
}
5) Create a PolylineClass and complete the change
ESRI.ArcGIS.Geometry.IPolyline pSegPoly = new ESRI.ArcGIS.Geometry.PolylineClass();
ESRI.ArcGIS.Geometry.IGeometryCollection pGeoColl = pSegPoly as IGeometryCollection;
pGeoColl.AddGeometry((IGeometry)path, ref obj, ref obj);
pGeoColl.GeometriesChanged();