How to retrieve the parameters of a Q# operation? Is it possible to do such a thing at all?
1 Answer
You are assuming a 1-1 mapping from a Q# operation with a C# operation but it doesn't work like that. A Q# operation can have a lot more functionality than a C# class, for example, Q# offers the ability to automatically create the adjoint
and controlled
versions of a the operation.
As Mariia pointed out, https://stackoverflow.com/questions/59022076/how-to-get-the-type-of-a-q-operation-parameter is a very similar question and the same answer applies:
Each Q# operations generations a C# class that extends the generic class Operation<I,O>
, so to figure out what the input/output parameters you can take a look at the BaseType
of the operation's Type
, and look at the value of the GenericTypeArguments[0]
to figure out the input type.
IQ#
been mentioned there? Does it help? $\endgroup$