Closed dodyg closed 3 months ago
You can always call asynchronous code in C#, but you can't always await it. In this case, the binding closure cannot return a task because that would make output
leave the stack, which would cause a memory allocation on every binding invocation.
There's nothing to stop you from doing this, though:
using var binding = lightSwitch.Bind();
// Monitor an output:
binding.Handle((in LightSwitch.Output.StatusChanged output) =>
StartSomeAsynchronousTask().ContinueWith(result => ...);
);
https://chickensoft.games/docs/logic_blocks/basics/outputs
Is there any version of this that can call async code?