I'm writing a Q# program and I'm calling an operation defined in the program that outputs a Result
(One
or Zero
).
For example something like this:
output = QuantumOperation.Run(sim).Result;
I want to convert now output
to a bool
within C#, but I don't know how.
One way to go around this is to change the output of QuantumOperation
to be a bool
and transforming the result at the end of the operation with ResultAsBool(result)
. However, I want to maintain the output of the operation to be a Result
. So ideally the conversion should happen within the C# host code.