I need to create a SafeArray to pass to a COM method.
How do I create/maintain/destroy a SafeArray in C#?
I have never came across SafeArrays before and could not find much with a quick google search, so any help is much appreciated.
EDIT: Added Sample Code:
The COM method signature
[id(0x000000d5)]
HRESULT GetTags(
[in] SAFEARRAY(long) buffer,
[out, retval] long* retval);
The generated interop method in C#
int GetTags(System.Array buffer)
Member of Cwise.IUser
So in this case do I have to create a SafeArray or can I simply pass a normal .Net Array to the COM method GetTags?
use such a code for this
Array ar = Array.CreateInstance(typeof (int), 500);
instead of typeof(int)
use your own data type, your COM object must say you what type is expecting.
User contributions licensed under CC BY-SA 3.0