How to get the segment along a polyline that contains an XY Coordinate

I have a polyline which has the need for a perpendicular line to be created at a certain point, I want to use the Construct perpendicular function to create my line, but I need to pass the segment my point is in as a parameter. How can I get my polyline in segments to identify which segment my point is contained in. I am using C#