Linx Main Linx Help

Writing C# in Linx

In Linx, sometimes you require functionality that is not built into the platform and need to develop your own custom functionality to achieve the task at hand. Typically you are able to build this functionality using the various Linx components, however, there is no point in re-inventing the wheel when the same functionality can be built using C# and .NET.

Using the built-in CSharpFunction, you are able to execute C# code within a Linx function, allowing you to access functionality from the .NET library.

Take the example of extracting a file name from a file path:


This can be achieved in Linx using the RegularExpression function, however, finding the exact pattern that you want to use can be time consuming and have unintended consequences.


Instead you are able to execute C# code that utilizes the .NET library. So for example, the GetFileName method.


This can be achieved in Linx by using the CSharpFunction which allows you to code and execute a single function within your Linx process

With the Linx CSharpFunction you are only able to execute a single function and therefore are unable to make use of the using clause, so you have to use the full type name (namespace + type name) whenever you reference a C# class i.e. System.IO.Path.

You are able to define inputs for the function and return any results like you usually would in C#.


Here and the two approaches in the same function:

This is a basic example but using the .NET library which is standardized and used by multiple developers instead of “rolling your own” is a better approach.

Take a look at our GitHub repo for more examples of these helper functions →