How do I update a Collider if I change the Mesh?

How can I change my mesh collider the same way as I change my mesh (cube.transform.GetComponent<MeshFilter>().mesh) even though the new object is not a cube anyomre with a script?

Uhm have you tried google before posting the question?