cursorlockmode cannot be used as a method C#

C#
 void Update() {         //Mouse lock and confine         Cursor.visible = false;         Cursor.lockState = CursorLockMode.Locked;         Cursor.lockState = CursorLockMode.Confined;  //and to unlock it is this:         Cursor.lockState = CursorLockMode.None;         Cursor.visible = true; }
Source

Also in C#: