How to convert C# code to C++ [closed]
I have a Data Structure class written in C#. How to convert that to C++ (managed)?
Don't convert it. One of the very nice features of .NET is that the types from one managed language can be used in another. Right-click your C++/CLI project, Properties, Common Properties, Framework and References. Click Add New Reference. Use the Projects tab if your C# project is in the same solution (recommended). Otherwise click the Browse tab and navigate to your C# assembly.
You can see how this is done in the Classes and Structs (Managed) page on MSDN. Just put the equivalent types and logic into your C++ ref class
, and you'll make a managed class in C++.
精彩评论