Did you know there’s actually a System.Void type? You could use it in some exotic scenarios to test if a value is of type void. One example where you might need this is in ContextBoundObject objects where you interfere with the messaging.
However, this bit of code will not work:
methodReturnMessage.ReturnValue is System.Void
You cannot use System.Void directly in C#, but will have to revert to typeof(void) instead. The code needs to use the variant of comparing type objects (the only available option in Visual Basic .NET):methodReturnMessage.ReturnValue.GetType() != typeof(void)