Dynamically change Canvas from Overlay to World Space (and back again)

Hi
Can anyone tell me how I might change a Screen Space Overlay Canvas to World Space dynamically (ie through code at runtime)?

seems to work,

by setting rendermode