In my project, I pass a byte[] from C# to C++ CLR function.
C++ CLR code:
void TestByteArray(array^ byteArray) { ... }
void TestByteArray(array<System::Byte>^ byteArray) { pin_ptr<System::Byte> p = &byteArray[0]; unsigned char* pby = p; char* pch = reinterpret_cast<char*>(pby); // use it... }
You're looking for the Encoding.GetChars() Method