public Union<TypeA, TypeB> GetThing()...
Without having to declare the union first. Basically OneOf<...> but built-in and more integrated #!/usr/bin/env dotnet run
#:package [email protected]
using Newtonsoft.Json;
Console.WriteLine(
JsonConvert.SerializeObject(new { Hello = "world" })
);
Even better, with the #:sdk directive, you can even serve a tiny web app directly from your "fancy shell script"... #!/usr/bin/env dotnet run
#:sdk Microsoft.NET.Sdk.Web
WebApplication
.Create()
.MapGet("/", () => "Hello from a shell script!")
.Run();