Passing Hashtable to Unmanaged code using interop
How can i pas开发者_StackOverflow中文版s 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.
加载中,请稍侯......
精彩评论