I'm building a COM component C#, where the customer can set binary data. It would be nice if the COM component returns exception rather than error code but I realized it would be difficult to handle exceptions in (Delphi, C + + and JScritp). Instead, I chose to receive data in hexadecimal (and internally convert to binary) and return in hexadecimal (internally convert binary to hexadecimal).
The method getData can return the data and an error code, now my question is: how to do this in C# interop?
in C++ COM, HRESULT exists
HRESULT getData([in] int __position, [out,retval] BSTR* __data); // can Return __data or error -1 data not exists
HRESULT setData([in] BSTR __data, [out,retval] int* __status);
But what is it's equivalent in C#?
int getData ??? // return __status or __data;
int setData(String __data); // return __status;
Thanks in advance!