How can i pass HashTable in .net to c++ using interop?
I know how to pass primitive types but need to know how can I pass the other ones.
You cannot pass the entire object to be used as a hash table in C++. P/invoke translate the .NET type to a type C++ can understand. For example, String is converted to a LPWSTR (wchar_t *). However it cannot convert something like a HashSet in this manner.
You can't.
There is no C++ parameter type to which you can pass a Hashtable (except a void*, which wouldn't do you any good)
Instead, you need to create a C++ struct to hold the information in the hashtable, port the struct to C#, then marshal the struct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With