Can return one of the given types, decided at runtime. The syntax
is to declare all the possible types in the return value, then you
can return typeof(return)(...value...) to construct it.
It has an auto-generated constructor for each value it can hold.
Can return one of the given types, decided at runtime. The syntax is to declare all the possible types in the return value, then you can return typeof(return)(...value...) to construct it.
It has an auto-generated constructor for each value it can hold.
If you have lots of returns, you could, inside the function, alias r = typeof(return); to shorten it a little.