我想开发一个 Windows 应用程序.如果我使用本机 C++ 和 MFC 作为用户界面,那么应用程序将非常快速且小巧.但是使用 MFC 非常复杂.此外,如果我使用 C#,那么应用程序将比本机代码慢,并且它需要 .NET 框架才能运行.但是使用 WinForm 开发 GUI 非常容易.你更倾向哪个?
I want to develop a windows application. If I use native C++ and MFC for user interface then the application will be very fast and tiny. But using MFC is very complicated. Also If I use C# then the application will be slower than the native code and It reqiures .NET framework to run. But developing GUI is very easy by using WinForm. Which one do you prefer?
快"和慢"是主观的,尤其是对于今天的 PC.我并不是说故意让事情变慢,但编写托管应用程序的开销并不像您想象的那样几乎.JIT 等可以很好地使代码执行得非常快.如果您确实需要,您还可以使用 NGEN 来提高启动速度.
"fast" and "slow" are subjective, especially with today's PC's. I'm not saying deliberately make the thing slow, but there isn't nearly as much overhead in writing a managed application as you might think. The JIT etc work very well to make the code execute very fast. And you can also NGEN for extra start-up speed if you really need.
实际上,如果你有时间学习它,你可能想考虑 WPF 而不是 winform - 这是一个不同的技能组合,但可以让你很好地利用图形硬件等.
Actually, if you have time to learn it, you might want to consider WPF rather than winform - this is a different skill-set, but allows you to make very good use of graphics hardware etc.
另外 - .NET 框架附带新的操作系统安装,并且在那些早于它的操作系统中仍然很常见.所以对我来说,使用 C#/.NET 开发将是一个相当明确的选择.开发一个强大且经过全面测试 C++ 应用程序(没有泄漏等)的时间(至少对我而言)比使用 C# 的时间要长得多.
Also - .NET framework comes with new OS installs, and is still very common on those that pre-date it. So for me it would be a fairly clear choice to develop with C#/.NET. The time to develop a robust and fully tested C++ app (with no leaks, etc) is (for me at least) much greater than the same with C#.
这篇关于我应该使用哪个平台:原生 C++ 或 C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!