G
Guest
I have the following managed C++ function (VC++ 2005 (C++/CLI)
System::Array^ ManagedCppClass::GetData()
{
BYTE* pData;
int len;
m_pureNativeCPPObj->GetData(pData, len); // Get the data buffer from
unmanaged class.
array<byte>^ Arr = gcnew array<byte>(len);
System::Runtime::InteropServices::Marshal::Copy((IntPtr)pAScan, Arr, 0,
len);
return Arr;
}
I think this function works.
But is there a better way to that (maybe without doing the copy) ?
System::Array^ ManagedCppClass::GetData()
{
BYTE* pData;
int len;
m_pureNativeCPPObj->GetData(pData, len); // Get the data buffer from
unmanaged class.
array<byte>^ Arr = gcnew array<byte>(len);
System::Runtime::InteropServices::Marshal::Copy((IntPtr)pAScan, Arr, 0,
len);
return Arr;
}
I think this function works.
But is there a better way to that (maybe without doing the copy) ?