5 Oct 20151 minute to read
Bitwise Operations are used to manipulate the flagged enumerations [enum]. In this section, Bitwise Operations are illustrated by using Graph Constraints. The same is applicable while working with Node Constraints, Connector Constraints, or Port Constraints.
|You can add or enable multiple values at a time by using Bitwise ‘||’ (OR) operator.|
node.Constraints = NodeConstraints.Select | NodeConstraints.Rotate;
In the above example, you can do both selection and rotation.
You can remove or disable values by using Bitwise ‘&~’ (XOR) operator.
node.Constraints = node.Constraints &~ NodeConstraints.Rotate;
In the above example, Rotation is disabled, but other constraints are enabled.
You can check any value by using Bitwise ‘&’ (AND) operator.
if ((node.constraints & (NodeConstraints.Rotate)) == (NodeConstraints.Rotate));
In the above example, you can check whether the rotate constraints are enabled in a Node. When Node constraints have rotate constraints, the expression returns a rotate constraint.