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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top