Visual C++ vs Visual C#,哪个最好学?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1981547/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual C++ vs Visual C# , which is the best to learn?
提问by M3taSpl0it
I've done my C++ classes and practices after which I started learning Visual C++ using book Ivor Horton's Visual C++. The problem is that I am unable to understand the language of this book and badly trying to understand the codes. I want to learn Visual C++ for Windows application development and making my future in that (also because I already know C++).
我完成了我的 C++ 课程和实践,之后我开始使用 Ivor Horton 的 Visual C++ 一书学习 Visual C++。问题是我无法理解这本书的语言,并且很难理解代码。我想学习用于 Windows 应用程序开发的 Visual C++ 并在其中创造我的未来(也是因为我已经了解 C++)。
Some of my friends told me to switch to C# since it has many library function to create GUI etc and told me it's hard to code Windows applications in Visual C++.
我的一些朋友告诉我改用 C#,因为它有很多库函数来创建 GUI 等,并告诉我很难用 Visual C++ 编写 Windows 应用程序。
Now in these holidays I am going to join classes, can you help me which language I should stick to, and which one will be easy?
现在这些假期我要去上课,你能帮我坚持哪种语言,哪种语言容易吗?
From very beginning I want to learn Visual C++ and sometimes I think it's hard when I don't understand concept in reference books etc.
从一开始我就想学习 Visual C++,有时当我不理解参考书等中的概念时,我觉得这很难。
Any help will be very appreciated, thanks a lot for taking your precious time.
任何帮助将不胜感激,非常感谢您抽出宝贵的时间。
采纳答案by Stefan Monov
Visual C++ and Visual C# are not languagesnor GUI frameworks; they are Integrated Development Environments- IDEs. This means they are text editors tailored to the task of development.
Visual C++ 和 Visual C# 不是语言,也不是GUI 框架;它们是集成开发环境- IDE。这意味着它们是为开发任务量身定制的文本编辑器。
Visual C++ lets you code in C++, Visual C# lets you code in C#. Also, both let you create GUIs in a point-and-click manner.
Visual C++ 允许您使用 C++ 编写代码,Visual C# 允许您使用 C# 编写代码。此外,两者都允许您以点击方式创建 GUI。
Sounds like what you really want to do is create GUIs. In that case, without having further information, I recommend you go for C#. It is a much cleaner language than C++, it has fewer ways to shoot yourself in the foot, and it provides access to the immensely useful .NET framework.
听起来您真正想做的是创建 GUI。在这种情况下,在没有更多信息的情况下,我建议您使用 C#。它是一种比 C++ 更简洁的语言,它有更少的方法让你自己动手,并且它提供了对非常有用的 .NET 框架的访问。
C# features that C++ doesn't have:
C++ 没有的 C# 特性:
- Fully automatic memory management
Lambda functions1Type inference1- Reflection
- Remoting
- Automatic serialization
- True entity types
- Properties
- Database integration via LINQ
- Convenient functional-style programming via LINQ
- No header files
- No undefined behavior
- Direct interoperability with many languages
- Compile once, run everywhere
- 全自动内存管理
Lambda 函数1类型推断1- 反射
- 远程处理
- 自动序列化
- 真正的实体类型
- 特性
- 通过 LINQ 进行数据库集成
- 通过 LINQ 方便的函数式编程
- 没有头文件
- 没有未定义的行为
- 与多种语言的直接互操作性
- 一次编译,到处运行
1 these features have been added to C++ in the C++11 standard.
1 这些功能已添加到 C++11 标准中的 C++ 中。
C++ features that C# doesn't have
C# 没有的 C++ 特性
- Template metaprogramming
- Typedefs
- Zero-overhead principle
- Means to enforce const-correctness
- Mature compilers that produce extremely optimized code nowadays
- Much wider platform support
- 模板元编程
- 类型定义
- 零开销原则
- 强制执行常量正确性的方法
- 成熟的编译器,如今可以生成极其优化的代码
- 更广泛的平台支持
回答by Reed Copsey
can you help me which language i should stick to , and which one will be easy.
你能帮我坚持使用哪种语言,哪种语言会很容易。
In general, if you're goal is to develop Windows Applications, you'll probably find many, many more simple examples to learn from in C# than in C++. There is a huge community around C# for Windows GUI development.
一般来说,如果您的目标是开发 Windows 应用程序,您可能会发现在 C# 中比在 C++ 中学习的示例要多得多。有一个围绕 C# 进行 Windows GUI 开发的庞大社区。
That being said, many of the concepts you'll need are the same in any language you learn. You can't really go wrong - at some point, you'll probably want to learn both langauges if you're going to program professionally (as well as others).
话虽如此,您需要的许多概念在您学习的任何语言中都是相同的。你真的不会出错 - 在某个时候,如果你要进行专业编程(以及其他语言),你可能想要学习这两种语言。
i think it's hard when i don't understand concept in ref books etc.
当我不理解参考书等中的概念时,我认为这很难。
You should get a beginning programming book, not reference books, and go through it step-by-step. If your goal is just GUI development, I'd recommend a good, simple C# book, and just step through it form beginning to end, and do all of the examples. Learning from a "reference" book won't work - it's reference material, and not meant to teach concepts.
你应该得到一本编程入门书,而不是参考书,然后一步一步地阅读。如果您的目标只是 GUI 开发,我会推荐一本好的、简单的 C# 书籍,从头到尾逐步完成,并完成所有示例。从“参考”书中学习是行不通的——它是参考资料,并不意味着教授概念。
回答by SwDevMan81
I would learn both.
我会两个都学。
Having said that, I would create GUI/Application projects using C#, and use VC++ for any COM or device communication.
话虽如此,我将使用 C# 创建 GUI/应用程序项目,并使用 VC++ 进行任何 COM 或设备通信。
I would check out Which platform should I use : native C++ or C# ?
回答by Robert Harvey
C++ vs. C# - a Checklist from a C++ Programmers Point of Viewhttp://www.thinkingparallel.com/2007/03/06/c-vs-c-a-checklist-from-a-c-programmers-point-of-view/
C++ 与 C# - 从 C++ 程序员的角度来看的清单http://www.thinkingparallel.com/2007/03/06/c-vs-ca-checklist-from-ac-programmers-point-of-view/
回答by Matt Gordon
Maybe consider what you are likely to want to do in the future, as a professional or a hobbyist. Programming is a wide field, in which both languages have their place. If its too early for you to make that decision, C# is probably most likely to do you good in the future.
也许考虑一下您将来可能想做的事情,无论是作为专业人士还是业余爱好者。编程是一个广阔的领域,两种语言都在其中占有一席之地。如果您现在做出这个决定还为时过早,那么 C# 很可能在未来对您有好处。
It's worth remembering that they are both only languages - and just as writing a good book is about more than correct spelling & grammar, writing good code is about more than the details of a particular languages syntax.
值得记住的是,它们都只是语言——就像写一本好书不仅仅是正确的拼写和语法一样,编写好的代码不仅仅是关于特定语言语法的细节。
回答by Gordon Gustafson
C#is the premeir .net language for developing applications on the .net framework.
C#是最好的 .net 语言,用于在 .net 框架上开发应用程序。
Native C++is more cross platform and low level. It's used for writing applications for windows, mac, linux, embedded systems, etc.
本机 C++更跨平台和低级别。它用于为 windows、mac、linux、嵌入式系统等编写应用程序。
C++.netis C++ adapted to the .net platform, and is primarily used for writing performance critical parts of an application (the rest of which is written in C#, VB.net, or something else as they integrate virtually seamlessly).
C++.net是适用于 .net 平台的 C++,主要用于编写应用程序的性能关键部分(其余部分用 C#、VB.net 或其他内容编写,因为它们几乎无缝集成)。
Visual C++is microsoft's windows compiler for C++ that can be used to write native and C++.net applications.
Visual C++是微软用于 C++ 的 Windows 编译器,可用于编写本机和 C++.net 应用程序。
Writing .net applications solely in C++ in much harder than writing them in C# as you have to deal with more low level issues. If you want to write .net applications, I recommend using C# and C++.net if you need it.
仅用 C++ 编写 .net 应用程序比用 C# 编写它们要困难得多,因为您必须处理更底层的问题。如果您想编写 .net 应用程序,我建议您在需要时使用 C# 和 C++.net。
回答by user366312
C# is largely intended for Business Applications so as Java. Visual C# is Microsoft's implementation of the C# programming language specification, included in the Microsoft Visual Studio suite of products.
C# 主要用于业务应用程序,例如 Java。Visual C# 是 Microsoft 对 C# 编程语言规范的实现,包含在 Microsoft Visual Studio 产品套件中。
C# is much slower than C++, since the code passes through CLR. VC++.net has the same drawback.
C# 比 C++ 慢得多,因为代码通过 CLR。VC++.net 也有同样的缺点。
VC++ is very hard to learn, so as MFC and windows programming, even though you know C++. But is it a prestigious and efficient language.
VC++ 很难学,就像 MFC 和 windows 编程一样,即使你知道 C++。但它是一种享有盛誉且高效的语言吗?
It is easy to switch from VC++ to VC#. But the reverse is harder.
从 VC++ 切换到 VC# 很容易。但反过来更难。
If you go for VC++, MFC and Windows programming, try this.
如果您进行 VC++、MFC 和 Windows 编程,请尝试此.
回答by jimmy
with C++, you could be able to touch the 'low level' near 'assembly things' part of programming
使用 C++,您可以触及编程的“装配”部分附近的“低级”
c# is never meant to be created to beat c++, with c# you get the whole .net framework utilities, faster cleaner form generations, with the lack of 'low level' part
c# 永远不会被创建来击败 c++,使用 c#,您可以获得整个 .net 框架实用程序,更快更清洁的表单生成,并且缺少“低级”部分