If the layer is a feature layer, you can get IPolyline from each IFeature by IFeature.Shape Property.
IPolyline polyline = feature.Shape as IPolyline;
IPoint fromPoint = polyline.FromPoint;
IPoint toPoint = polyline.ToPoint;
Now create a point feature class and add these points as feature to that feature class.
I am guessing you are working with all features of your feature class. If that is not right, just change the search method as you need:
List<IFeature> GetAllFeatures(IFeatureClass ArcFeatureClass)
var featureCursor = ArcFeatureClass.Search(null, false);
var features = new List<IFeature>();
while ((feature = featureCursor.NextFeature()) != null)
List<IPoint> GetEndPoints(List<IFeature> features)
var points = new List<IPoint>();
foreach(var feature in features)
var polyline = feature.Shape as IPolyline;
Now create a point feature class. Suppose, name of that feature class is 'pointFeatureClass'. If you need help to create feature class, you can go through this.
void AddFeatures(List<IPoint> points, IFeatureClass pointFeatureClass)
if (pointFeatureClass == null)
foreach (var point in points)
IFeature feature = pointFeatureClass.CreateFeature();
feature.Shape = point;
This code will put a point on each end of a polyline. For your figure, it will create 8 points. If you want to customize it, you can put your own logic.