It can be helpful to implement Q# functions or operations directly in C# - either to access some API that is not directly accessible in Q# or to provide alternative implementations based on the context in which the Q# program is executed. This blog post describes techniques to programmatically replace a Q# function by another one.