Building CSX Function Scripts

The CSX script represents interpreted C# code. When we use this script, we don’t precompile our code into a lower-level language as we normally do with C#. Instead, we post the raw code. When the function is invoked, the code is translated into an executable set of low-level instructions on the fly.

The advantage of this approach is that we can modify the logic inside our function even when it’s deployed. The main disadvantage of this is that it’s a non-standard way of using C#, therefore, it requires special tools and incurs more development overhead if we want to develop such a function locally.

The below project contains an example of a function app consisting of a CSX script. This project represents a simple function with the HTTP trigger and basic chatbot functionality. We can trigger it by sending either a GET or POST HTTP request to it. If we don’t send any data in the request, it returns a response asking for our name. If we send the name either in the name query string parameter or the name field of the request body, the function returns the response that greets us by the name.

Get hands-on with 1400+ tech skills courses.