I want to add some .h and .cpp files to a C# project to get the C++ functionality in C#. I want to use the code directly without making a dll.
Can i do so? How?
No you cannot. If the amount of code is small, you can write a C# class and paste pieces of the C++ code into it so that you essentially ported that class into C#. Obviously this won't work if you're using a language feature or library function that is not in C#. Alternatively you need to compile your C++ code into something executable (either a native DLL, ideally C-style flat functions, or a managed assembly) so that you can call it from your C# code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With