views:

253

answers:

6

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.

+1  A: 

In terms of the backend, they both run on the CLR and both capable of the job. Really it just comes down to what you're most comfortable with. If you're not sure, experiment with both. Use whatever feels most productive.

Edit:

As has just been pointed out to me though, it seems support for WPF templates (and possibly even intellisense) just isn't there for C++. So in that case I guess I'd have to recommend C#.

nukefusion
Not really: Visual Studio has IDE features to support WPF development with C# (and VB.NET) but not for C++/CLI. And then there's this: http://stackoverflow.com/questions/2681999/no-intellisense-for-c-cli-in-visual-studio-2010
Daniel Earwicker
Thanks for bringing that to my attention. I didn't realise support was that lacking.
nukefusion
+1  A: 

C# is the most used, so if you have trouble, there is more online support for C#. C# also has better support by Microsoft. It's overall just a more finished product, even now. If you really don't care yourself, i'd go with C#.

Jouke van der Maas
Not true. C++/CLI *is* a finished and wonderful product, especially with C++0x specifications and the ability to use C++ header-only template libraries. However it is seldom the right tool for the job.
Alexandre C.
I think C++ is better for games, where you need to get to a basic level often. WPF is trying to do the exact oposite; 'get away from drawing and let me do everything for you'. C# just fits that concept better.
Jouke van der Maas
+11  A: 

Firstly: 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 in that trap like I did.

Samuel_xL
+2  A: 

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#.

Dan Puzey
+4  A: 

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).

Daniel Rose
+1  A: 

IMO without a doubt C# (or VB/F#).

C++/CLI is great when crossing the border of managed world and a c++ library. Complexity is higher though as subtle issues arises from the fact that one combine a managed language and an unmanaged.

Compile times are longer though as well in C++/CLI especially since the code templates are modelled after how the C# compiler works not on how the C++ compiler works.

FuleSnabel