For the grid what you have there seems little weird. The step is usually i++ and the amount of steps usually done by second part of the for loop conditions with i ans an integer (this also won’t get potential floating point errors). What I mean is you are being redundant in making a kind of step decimal there when you already have inputs for u and v might as well just use that as the amount of loops.
Also, you you are dealing with division count you don;t really need to reset the domain, usually you reset the domain if you are dealing with parameter values for the input. So you can just do some math dividing by the length of the domains.
private void RunScript(Surface S, int U, int V, ref object A)
List<Point3d> uvGrid = new List<Point3d>();
for(int i = 0; i < U + 1; i++)
for(int j = 0; j < V + 1; j++)
Point3d srfPt = S.PointAt(S.Domain(0).Length / U * i, S.Domain(1).Length / V * j);
A = uvGrid;
So what you have is perfectly valid, it just seems a bit not standard for usual for loop routines.