Search code examples
c#.netc++unmanagedmanaged-code

What advantages are there to developing a Win32 app in C++ over a .NET app in C#?


I learned windows programming using Visual C++, and the Win32 API. Nowadays, it seems most apps are being developed in .NET using C#. I understand that most of the time there isn't much performance difference between native code and managed code. So I'm wondering, if I were to start writing a new desktop app today, is there any reason (other than the fact that I'm more familiar with C++), that I might want to write it in non-managed C++ instead of .NET? Are there still some advantages to using C++ and native code? Or has that method been more-or-less replaced with .NET on the Windows platform?

Of course I know that people who are writing low-level device drivers and similar programs wouldn't do it in .NET. I'm asking with reference to typical client-facing apps that don't make direct hardware calls.


Solution

    • Performance (certain situations, such as graphics)
    • Memory footprint (as Mancuso said)
    • Use of existing libraries
    • No need for a runtime
    • Finer control

    To list a few.

    However, you may also want to look at the question from the opposite angle to fairly evaluate which language to use.

    Additionally, you could use C++/CLI to incorporate both native and .net code.