This might be a stupid question, but I want to do the equivalent of
passinf an arguement via the "out" keyword in C#, But in CLI. SO I
basically want to pass a managed object from c# into a CLI layer, make
changes to the object in the CLI layer, and have them reflected in the
c# layer. Could someone please show me the syntax to do this?
Tamas Demjen - 07 Jun 2007 20:30 GMT
> I want to do the equivalent of
> passinf an arguement via the "out" keyword in C#, But in CLI.
In C++/CLI, you can try this:
void foo([System::Runtime::InteropServices::Out] int% value)
which is equalivalent to the following in C#:
public void foo(out int value)
Another example, this time with a ref class:
void foo([System::Runtime::InteropServices::Out] String^% value)
//C++
public void foo(out string value)
//C#
Tom
William DePalo [MVP VC++] - 07 Jun 2007 20:33 GMT
> This might be a stupid question, but I want to do the equivalent of
> passinf an arguement via the "out" keyword in C#, But in CLI. SO I
> basically want to pass a managed object from c# into a CLI layer, make
> changes to the object in the CLI layer, and have them reflected in the
> c# layer. Could someone please show me the syntax to do this?
Take a look at this page belonging to my friend Tomas Restrepo:
http://www.winterdom.com/cppclifaq/archives/000421.html
Regards,
Will
Ben Voigt [C++ MVP] - 07 Jun 2007 20:50 GMT
> This might be a stupid question, but I want to do the equivalent of
> passinf an arguement via the "out" keyword in C#, But in CLI. SO I
> basically want to pass a managed object from c# into a CLI layer, make
> changes to the object in the CLI layer, and have them reflected in the
> c# layer. Could someone please show me the syntax to do this?
That doesn't sound like an out parameter at all, it sounds like passing a
managed handle to the C++/CLI code, for which you would use
'MyClass^ paramname'
in the argument list.
DaTurk - 07 Jun 2007 21:07 GMT
> > This might be a stupid question, but I want to do the equivalent of
> > passinf an arguement via the "out" keyword in C#, But in CLI. SO I
[quoted text clipped - 8 lines]
>
> in the argument list.
THank you, that was alot of help.