Skip to content

FR CSharp Directive Load

Codex edited this page Oct 11, 2026 · 2 revisions

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

Connexion des sorties .csx

Manuel C# · Guide pratique

La directive de script charge un autre fichier .csx. Pour un projet standard, utilisez Compile ou ProjectReference.

Exemple simple (Example.csx)

Enregistrez cet exemple séparément dans Example.csx. Exécutez-le indépendamment des autres exemples de cette page.

Example.csx:

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

helper.csx:

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

Résultat:

8

Syntaxe

#load "helper.csx"

Une fonction auxiliaire distincte

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

Fichier helper.csx :

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

Fichier de configuration

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

Fichier settings.csx :

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

Source officielle : Microsoft Apprendre.

Clone this wiki locally