# CSharpFunction

**CSharpFunction** can contain any C# function's code that you want to include in your solution.

***

## Properties

### Function

The function definition to execute. Click on the **\[...]** icon to open the Function Editor.

An example function is included as a reference. You can replace this with your own function.

When writing a new function, please note that any access modifiers (e.g. *public* or *private*) will be ignored, so it is not necessary to add them. The name of the function is also not important (and independent of the name of the Linx function), although it may help to specify a descriptive name to convey the purpose of the function.

Parameters will be extracted and listed in the Parameters section, while the result of the function (if any) will be used as the output of your Linx function.

**Accessing System Classes**

Linx allows access to the System classes (for example Math or IO). This can be done by calling the fully qualified class name. For example, to access the **Abs** function in the **System.Math** class, you will need to use **System.Math.Abs()**.

Only static members and functions are available to use.

***

## Parameters

In this section, you can assign values to the parameters that are defined in your function. The list of parameters will automatically update when changes are made to the function.

***

## Example

The example function in the Function Editor returns "Hello \[name]!".

<div align="left"><figure><img src="/files/R4c7PsdaONigRSJmPazv" alt="CSharpFunction"><figcaption></figcaption></figure></div>

When you save the function definition in the Function Editor, the name parameter is created in the Parameters section. Enter or select any value for the name parameter, e.g. "Jane". When you run the function, "Hello Jane!" will be returned.

The function's output will be available for use by other functions, e.g. SetValue. Expanding on our example, the target String in the screenshot below will be set to "Hello Jane!".

<div align="left"><figure><img src="/files/y1iTA015sE3SpLCyI2sF" alt="CSharpFunction"><figcaption></figcaption></figure></div>

***

## Links

[Writing C# in Linx](https://community.linx.software/community/t/writing-c-in-linx/562)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.linx.software/reference/plugins/csharp/content/csharpfunction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
