# Why do I get an error about being unable to change rasterizer states in this code?

I'm trying to toggle between wireframe and full mode while drawing a 3d model. So far I have this

 rs = new RasterizerState();


In my update method:

  if (state.IsKeyDown(Keys.V))
{
rs.FillMode = FillMode.WireFrame;
}

if (state.IsKeyDown(Keys.C))
{
rs.FillMode = FillMode.Solid;
}


and in my draw method:

  GraphicsDevice.RasterizerState = rs;


But I get the error:

 Cannot change read-only RasterizerState. State objects become read-only the first time they are bound to a GraphicsDevice. To change property values, create a new RasterizerState instance.


What am I doing wrong here?

You can't change rasterizer state objects once you have bound them to a graphics device (which happens the first time you assign rs to GraphicsDevice.RenderState). Instead, create a new rasterizer state with your desired settings and assign that to the device.