Is it possible to use C++ code in C#?

N

Nicholas Paldino [.NET/C# MVP]

Nick,

No, it is not. The only way you could do it is through COM Interop, the
P/Invoke layer, or by creating a managed wrapper.

Hope this helps.
 
R

Ricky

Hi,

In fact, I have some codes orginally written using C++/ATL, my concern
is to port the code into a C# project.

For the choices you adviced, which is the most easiest method of doing this?

Thanks.
 
N

Nicholas Paldino [.NET/C# MVP]

Ricky,

Why port it? If you have it written in using C++ and ATL, then I assume
it is a COM object? If it works, why spend the money to port it? I would
just use COM interop, setting a reference to the COM object in my .NET
project.
 

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

Top