To use it, just create another Class module in the same Namespace then you can call it like so
var alignLabelSets = RangeList(myAlignment);
which will return a list of LabelSetRange objects. You can the loop through those like so:
foreach (LabelSetRange r in alignLabelSets)
{
ed.WriteMessage("\nLabelSet named {0} goes from Station {1} to Station {2}.", r.Name, r.RangeStart.ToString("F2"), r.RangeEnd.ToString("F2"));
//or however else you intend to use the stations
}
I should note that since the Alignment object derives from the Curve object, you can use Curve properties on the Alignment. Thereby allowing you to save some processing time by changing this:
double eastingstart = 0;
double northingstart = 0;
double eastingend = 0;
double northingend = 0;
myAlignment.PointLocation(s, 0, ref eastingstart, ref northingstart);
myAlignment.PointLocation(end, 0, ref eastingend, ref northingend);
Point2d startp = new Point2d(eastingstart, northingstart);
Point2d endp = new Point2d(eastingend, northingend);
to this:
Point2d startp = new Point2d(myAlignment.StartPoint.X, myAlignment.StartPoint.Y);
Point2d endp = new Point2d(myAlignment.EndPoint.X, myAlignment.EndPoint.Y);