ref or In,Out?

  • Thread starter Thread starter Dirk Reske
  • Start date Start date
D

Dirk Reske

Hello,

I don't know how to use the In and Out attribute.
Is it better to use them in a P/Invoke call?
Or can I use "ref" instead, how I do it til now.

thx
 
Hello,

I don't know how to use the In and Out attribute.
Is it better to use them in a P/Invoke call?
Or can I use "ref" instead, how I do it til now.

thx

in c# there is only ref and out. in/out exist only for compatibility reason
in interop calls.

just keep using ref.
 
Dirk,
I don't know how to use the In and Out attribute.
Is it better to use them in a P/Invoke call?
Or can I use "ref" instead, how I do it til now.

Some types are marshaled as in parameters only by default, and you
must add the Out attribute to get data marshaled back as well. Adding
the ref keyword isn't always a solution, since it adds an extra level
of indirection.



Mattias
 
Back
Top