Linerenderer check position

I need to check if every x value in position has approximately the same value (drawing shapes and create an object out of it).
I can’t find a solution to this problem.

foreach (Vector3 points in linerenderer.positions?) how do I access the list of positions? GetPositions doesnt work.

Vector3 positions = new Vector3[m_LineRenderer.positionCount];
m_LineRenderer.GetPositions(positions);
foreach (Vector3 pos in positions)
{
///if(do your comparison check here)
}

This is what I’m currently using, but I am hoping there is something better