在 Visual Studio 2015 中,我应该启用/禁用该选项来激活 ByVal
的自动生成VB.Net 的关键字?
我尝试切换“漂亮的代码列表(重新格式化)”选项,但它没有生效。
也许有通过 Visual Studio 的第 3 方扩展的替代解决方案吗?
最佳答案
此行为在 Visual Studio 2010 Service Pack 1 中已更改。
卡洛斯·金特罗 writes in his blog :
"I e-mailed the program managers who changed this behavior, which in turn introduced me the developer, and they confirmed that there is no setting (and no plans) to get the old behavior in the VB.NET code editor."
因此,目前恢复该行为的唯一可能方法似乎是安装 Visual Studio 2010 并且不安装任何服务包。对于大多数人来说这可能不是一个合理的解决方案......
首先自动添加ByVal
关键字的主要原因似乎是VB 6中传递参数的默认方式是ByRef
。据说 VB 必须更改默认值才能合理地过渡到 .NET,但这会让 VB 6 程序员感到困惑,因此 IDE 自动将其指定为特定值。
如今,不再需要将其具体化以避免 VB 6 程序员感到困惑。如果您从 VB 6 过渡到 VB 14,您应该会看到巨大的变化。
关于.net - 如何在 Visual Studio 2015 中默认激活 ByVal 关键字的插入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31886074/