C# Code
AI-generatedSummary
Execute custom C# code on input items with configurable mode, timeout, and script.
Inputs
- mode — Execution mode: 'allItems' processes the whole input array at once; 'perItem' processes each item individually.
- timeoutMs — Maximum execution time in milliseconds before the C# runner process is killed.
- code — C# script to run; can use globals Items (input array), Item (current item), Index (loop index). Must return a JSON‑serializable object containing an 'ok' flag.
Output shape
an array of objects
Each output item contains a
jsonproperty with the processed result; on success the operation returns an array (empty if no items are produced). Errors are thrown as n8n execution errors.
Examples
Example 1: Add a processed flag to each input item
Set Mode to 'perItem', Timeout (ms) to 20000, and Code to return new Item() { json = $node.item.json, Processed = true };.