Skip to content

EN CSharp Directive Load

Codex edited this page Oct 11, 2026 · 2 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

Connecting .csx outputs

Handbook C# · Practical Guide

The script directive loads another .csx file. For a regular project, use Compile or ProjectReference.

Simple example (Example.csx)

Save this example separately as Example.csx. Run it independently of the other examples on this page.

Example.csx:

#load "helper.csx"
UO.Print(Double(4).ToString());

helper.csx:

int Double(int value) => value * 2;

Result:

8

Syntax

#load "helper.csx"

A separate auxiliary function

#load "helper.csx"
UO.Print(Double(4).ToString());

File helper.csx:

int Double(int value) => value * 2;

Configuration file

#load "settings.csx"
UO.Print($"{ProfileName}:{Limit}");

File settings.csx:

string ProfileName = "Archer";
int Limit = 3;

Official source: Microsoft Learn.

Clone this wiki locally