Calling native code from C#
If you are like me, you like optimizing and profiling your code making it as fast as possible. However, at one point you might realize the C# language does not give you the best performance for whatever the purpose of your code is. Since C# is running in the Common Language Runtime (CLR), there is a larger overhead between what the machine is doing and what your code is doing. It is therefore necessary to go a language of lower level. In my case, I went to C++. C++ is compiled into assembly code when compiled, making it a low-level language. You can also go deeper if the C++ code does not give the desired performance. However, if the code you want to have in C++ contains just a few lines of code, it could in fact be a better way to keep it in C#.