I am trying to keep my enemy object from rotating on the z and x axis while patrolling.
I was using this set up in unity script but want to change it to C#
Alternatively, you could automatically squash the angle down in the previous step-
Vector3 correctTarget = new Vector3(target.position.x, transform.position.y, target.position.z);
transform.LookAt(correctTarget);
and not worry about the exact Quaternions at all! There are very few situations where you would want to manually change the contents of a quaternion. Unless you are very familiar with the (literally complex) mathematics of them, there’s no point trying, since the Quaternion class provides plenty of utilities for creating and modifying quaternions in ways which are much easier to understand!