C ++ / CLI:C# [英] C++/CLI : Advantages over C#

查看:113
本文介绍了C ++ / CLI:C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#上管理C ++ / CLI有什么主要优点。绝对不是我认为的语法,因为C ++ / CLI中的下面的代码是真的丑陋的,

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代码:

C++/CLI code:

[Out]List<SomeObject^>^% someVariable

与上面的C#代码比较:

Compare above with C# Code:

out List<SomeObject> someVariable

只是出于好奇,在C ++ / CLI中有一个更丑陋的语法。

Just out of curiosity, is there an even uglier syntax in C++/CLI as compared to the above.

推荐答案

几乎只有一种互操作性语言 - 允许.Net代码访问旧的C ++库, native)可访问.Net库的C ++代码库(以及这些主题上的一些变体)。

It's almost exclusively an interopability language - both for allowing .Net code to access legacy C++ libraries, or for extended existing (native) C++ code bases with access to .Net libraries (and some variations on these themes).

应用程序完全在C + + / CLI,甚至给你一些语言功能不可用纯C + +(如垃圾收集),我怀疑有很多人谁会这样做。如果你已经离开纯C ++,并且没有与.NET互操作的目标,可能有更自然的选择(例如 D Scala ,例如 - 根据您想要的方向

While it is possible to write fully fledged applications solely in C++/CLI, and it even gives you some language features not available in pure C++ (such as garbage collection), I doubt there are many people who would actually do this. If you're already moving away from pure C++ and don't have the goal of interop with .Net there are probably more natural choices (such as D or Scala, for example - depending on which direction you want to go in).

类似地,从纯C#转移到C ++ / CLI可能会带来C ++模板的优点,但是这种需求很少会导致你采取该步骤。

Similarly, moving from pure C# to C++/CLI could arguably bring the advantages of C++ templates, but it's rare that this need would lead to you taking that step.

这篇关于C ++ / CLI:C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆