MagicOnion icon indicating copy to clipboard operation
MagicOnion copied to clipboard

C# - How to return void on contract definition

Open renanfaccin opened this issue 9 months ago • 1 comments

Using C# language to make GRPC calls with MagicOnion library, how to create a method that return void without to use UnaryResult struct? This struct force to inform a return type. I would like to create methods that returns nothing.

Thanks!

renanfaccin avatar Mar 05 '25 18:03 renanfaccin

You must use UnaryResult for the return type of MagicOnion's Unary. If you are looking for something equivalent to void, you can use the generic UnaryResult.

In the case of async, you can return no value, and even if it is not async, you should return default or UnaryResult.CompletedResult.

mayuki avatar Mar 10 '25 08:03 mayuki

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Sep 07 '25 00:09 github-actions[bot]