Visual Studio VB pretty listing settings

时光怂恿深爱的人放手 提交于 2019-11-28 09:32:20

问题


Does anyone know how to stop Visual Studio VB.NET editor from changing my beautiful scientific notation numbers into hideous decimal notation?

It seems that this is part of "Pretty Listing" (single checkbox in the options). I'd like to keep the other features of pretty listing, I just don't want to have to stare at 0.0000000000000001 when I could be looking at 1e-16


回答1:


I don't think there's a way to do it. You could rely on the implicit CDbl() conversion in this situation:

Dim myPrettyNumber As Double = "1E-16"

Or if you just want to be able to read it more easily, add a comment:

Dim myUglyNumber As Double = 0.0000000000000001 ' 1E-16



回答2:


You may turn pretty listing back on after defining your constants.

Visual Basic won't obfuscate numbers that have already been defined so long as you don't modify the lines that they're on. If you accidentally do modify a line being forced to scientific notation Visual basic will only convert that line to use fixed notation.

Obviously this works best for the declaration of constants or formula's that won't change very often. It is less viable otherwise.




回答3:


There is an option in VB to turn off "pretty listing":

http://msdn.microsoft.com/en-us/library/vstudio/y0y5th94.aspx



来源:https://stackoverflow.com/questions/2020615/visual-studio-vb-pretty-listing-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!