Mesh.Vertices.ToPoint3fArray read only?

i can’t set any property of the points in the list retrieved from ToPoint3fArray (3d also)
i had a similar problem some time ago - i guess i am overlooking something simple…
thanks

import Rhino
import scriptcontext

mesh = Rhino.Geometry.Mesh()
mesh.Vertices.Add(0.0, 0.0, 0.0)
mesh.Vertices.Add(1.0, 0.0, 0.0)
mesh.Vertices.Add(1.0, 1.0, 0.0)
mesh.Faces.AddFace(0, 1, 2)
mesh.Normals.ComputeNormals()
mesh.Compact()

vert = mesh.Vertices.ToPoint3fArray()
vert[0].Z = 1.0 # Why this does not change the Property?
print(vert[0]) # Prints 0.0 instead 1.0

scriptcontext.doc.Objects.AddMesh(mesh)

This is because the vertices are value types. When you do vert[0] you get a copy of the vertex. The copy gets changed, but the original is still in the array. Try if this works

vertex = mesh.Vertices[0]; // get a copy of the vertex
vertex.Z = 1.0; // change the vertex 
mesh.Vertices[0] = vertex; // assign the vertex to the mesh' vertex collection

thanks, i think i understand now better