> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/2.3/api/csharp/yarn/yarn.library/yarn.library.registerfunction-7.md).

# RegisterFunction(string,Delegate)

Method in [Library](/2.3/api/csharp/yarn/yarn.library.md)

## Summary

Registers a new function that returns a value, which can be called from a Yarn program.

```csharp
public void RegisterFunction(string name, Delegate implementation)
```

## Parameters

| Name                             | Description                                           |
| -------------------------------- | ----------------------------------------------------- |
| `string` name                    | The name of the function.                             |
| `System.Delegate` implementation | The method to be invoked when the function is called. |

## Type Parameters

| Name    | Description                      |
| ------- | -------------------------------- |
| TResult | The return type of the function. |
