Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should a WPF application be written in C++/CLI or C#?

WPF applications are, at its core, managed applications? Right? So, I have to choose between using managed C++ or managed C#. I experimented with managed C++ years ago. It seemed to be not quite be ready for primetime. I'm guessing Microsoft has put more effort into managed C# than managed C++. So, it seems like using managed C# is the best alternative between the two. Is this the case? What experiences have you had with WPF in either language? Thanks in advance.

like image 339
zooropa Avatar asked Aug 12 '10 12:08

zooropa


3 Answers

Managed C++ has been replaced by C++/CLI, and "managed C#" is just C#.

I would strongly recommend you to use C# for a new project, and use C++/CLI only when needed. C# has a better support, has a larger user base, and is easier to work with inside Visual Studio 2010.

Additionally, keep in mind that C++ and C++/CLI are two different languages. For my first .Net project, I chose C++/CLI because I already knew C++, and this was a very bad idea: the learning curve from C++ to C++/CLI is similar to learning C# from C++: don't fall into that trap.

like image 99
KeatsPeeks Avatar answered Nov 15 '22 19:11

KeatsPeeks


C++/CLI was only really made to support writing interop layers between unmanaged code (i.e. native C/C++) and managed code. For "heavy lifting", you should definitely use C# (or VisualBasic.NET).

like image 23
Daniel Rose Avatar answered Nov 15 '22 19:11

Daniel Rose


You can use managed C++ for your backend but, on inspection, VS (I'm using 2010 Ultimate) doesn't have any in-built templates for a C++ WPF application - only C# or VB.

I'm sure you could force it to work if you wanted to, but I'd suggest you use C#.

like image 45
Dan Puzey Avatar answered Nov 15 '22 20:11

Dan Puzey