C++/CLI : Advantages over C#

前端 未结 11 2227
自闭症患者
自闭症患者 2021-01-05 00:54

Is there any major advantage of managed C++/CLI over C#. Definitely not the syntax I suppose as the following code in C++/CLI is real ugly,

C++/CLI code:

<         


        
11条回答
  •  迷失自我
    2021-01-05 01:09

    I can think of 3 main reasons to use C++/CLI:

    1. You already have a large C++ project and want to use .NET in it (whether you want to migrate it completely in the future or not)
    2. You want to use a library written in C or C++. For simple libraries, you can use C#/PInvoke, but e.g. if the libary comes with a complex type system, you might be better off creating C++/CLI wrappers instead of recreating the type system in C#
    3. Parts in your project are best written in C++. E.g. if you're doing speech recognition or image processing, C++ might simply be better suited for the task.

提交回复
热议问题