C#
Goal
Write a C# block as a .NET file-based app. You don’t need a project file. Time: 10 minutes. Needs: .NET SDK 10 or later.
Things to know
- The runner runs
dotnet run snippet.csusing file-based apps. Use top-level statements: you don’t need aclassorMain. - Build output with
JsonObject.ToJsonString(). Reflection-basedJsonSerializer.Serialize(anonymousObject)may be disabled in file-based apps. - The first run of a snippet compiles it, so expect a few seconds of start-up.
- An unhandled exception exits with a non-zero code, so the block fails.
Reading plain text
For Execute step with plain text:
Check your run
Execute step prints {"message":"Hello from curl"}.
Exercise
Publish reversed: the text with its characters in reverse order.