To modify the items in a list, there's no need to create a new list. Just iterate over the items in the list and modify them.
foreach (Polyline x in listPolyline)
{
x.Value = Math.Round(x.Value, 5);
}
The only complication comes if you're using a
struct
; if you are, then any changes you make will apply to a copy of the struct, and not the value in the list. You would need to update the list with the modified value:
for (int index = 0; index < listPolyline.Count; index++)
{
Polyline x = listPolyline[index];
x.Value = Math.Round(x.Value, 5);
listPolyline[index] = x;
}
Structure types - C# reference | Microsoft Learn[
^]