Search code examples
.netc++-clipass-by-reference

ref and out in C++/CLI


I know that the C++/CLI code

void foo(Bar^% x);

transforms into

Void foo(ref Bar x);

What is the C++/CLI code that becomes

Void foo(out Bar x);

?


Solution

  • You can use the OutAttribute:

    using namespace System::Runtime::InteropServices;    
    void foo([Out] Bar^% x);