Tuesday, May 12, 2009

Parameters passing between C# and C++/CLI

In C#, parameters can be pass as "ref" or "out".
When writing a C++/CLI library, for the sake of interoperability, we might need to use these features in C++/CLI too.
Mapping:
C# C++/CLI
ref x x% // Managed type reference
out x [System::Runtime::InteropServices::Out] x %