是否有优化code在C#中的风险? [英] Are there risks to optimizing code in C#?

查看:131
本文介绍了是否有优化code在C#中的风险?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2010专业版的构建设置面板中,有一个与标签优化code当然是......,我想看看一个CheckBox ......但作为异常谨慎,我问我的兄弟约它,他说,这是选中的调试和在C ++中它可能做的事情,将打破或错误的code ......但他不知道关于C#。

In the build settings panel of VS2010 Pro, there is a CheckBox with the label "optimize code"... of course, I want to check it... but being unusually cautious, I asked my brother about it and he said that it is unchecked for debugging and that in C++ it can potentially do things that would break or bug the code... but he doesn't know about C#.

所以我的问题是,我可以检查这个盒子我的发布版本,而不必担心它打破我的code?第二,如果能突破code,什么时候,为什么?链接解释的欢迎。

So my question is, can I check this box for my release build without worrying about it breaking my code? Second, if it can break code, when and why? Links to explanations welcome.

推荐答案

您通常会使用一个发布版本此选项。它的安全和主流的这样做。我们没有理由害怕释放code启用了优化。启用优化可以调试这是一个很好的理由来禁用它建立调试干扰。

You would normally use this option in a release build. It's safe and mainstream to do so. There's no reason to be afraid of releasing code with optimizations enabled. Enabling optimization can interfere with debugging which is a good reason to disable it for debug builds.

这篇关于是否有优化code在C#中的风险?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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