none
C# or C++? RRS feed

  • Question

  • Hello,

    First I apologize if this is not the correct forum for my question, I thought this came closest.

    For many years I programmed C++ and am now learning C# but I still wonder why I do not start with Visual C++...;-)

    My main question is: what is the essential difference between C# and Visual C++ concerning their goal applications? Where would I rather use Visual C++ and not Visual C#?
    Are low level array handlings in Visual C# as fast as in Visual C++?

    I studied some Internet articles but still it is unclear to me.
    Just like to hear from an expert...

    regards,

    Henk

    Saturday, March 3, 2007 8:52 AM

Answers

  • For the most part an application can be written in C# or C++ or C++/CLI (managed C++).  It depends mostly on what you want to do with regards to whether you can go with a managed language or a native language.

    If you need to write in-process components that are used by native applications then you'll probably want to go with a native language.  IE add-ins, or Windows Shell extensions are a good example.  When a native application loads a managed (.NET) component the .NET framework is injected into the application.  There can only be one framework at a time injected in an application so if the first .NET component loaded by the application was .NET 1.1, no .NET 2.0 components would then be loaded.  See http://blogs.msdn.com/oldnewthing/archive/2006/12/18/1317290.aspx for more detail.

    If you have lots of legacy C++ code that you may not have time to convert to managed all at once, C++/CLI may be the way to do.  You can still use that existing C++ code through C++ Interop and updated it to C++/CLI as time permits.

    Otherwise, if you want to learn C#, go with C#; if you're comfortable with C++, stick with C++.

    Saturday, March 3, 2007 3:44 PM
  • My 2Cents.

    Whenever you need speed go with C++ but be carefull because it is unmanaged and you need to take care of your objects. Whenever performance is not critical it is easier to do your task with C#.

    Wednesday, July 3, 2019 9:09 PM

All replies

  • For the most part an application can be written in C# or C++ or C++/CLI (managed C++).  It depends mostly on what you want to do with regards to whether you can go with a managed language or a native language.

    If you need to write in-process components that are used by native applications then you'll probably want to go with a native language.  IE add-ins, or Windows Shell extensions are a good example.  When a native application loads a managed (.NET) component the .NET framework is injected into the application.  There can only be one framework at a time injected in an application so if the first .NET component loaded by the application was .NET 1.1, no .NET 2.0 components would then be loaded.  See http://blogs.msdn.com/oldnewthing/archive/2006/12/18/1317290.aspx for more detail.

    If you have lots of legacy C++ code that you may not have time to convert to managed all at once, C++/CLI may be the way to do.  You can still use that existing C++ code through C++ Interop and updated it to C++/CLI as time permits.

    Otherwise, if you want to learn C#, go with C#; if you're comfortable with C++, stick with C++.

    Saturday, March 3, 2007 3:44 PM
  • My 2Cents.

    Whenever you need speed go with C++ but be carefull because it is unmanaged and you need to take care of your objects. Whenever performance is not critical it is easier to do your task with C#.

    Wednesday, July 3, 2019 9:09 PM