.net - 如何在 Visual Studio 2015 中默认激活 ByVal 关键字的插入?

标签 .net vb.net visual-studio visual-studio-2015

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/

相关文章:

c# - 如何在已编译的 .NET 程序集中使用 Matlab 对象?

c# - Parallel.Invoke 不等待异步方法完成

c# - 开头带有一些无效数据的 TripleDes 解密

vb.net - WebBrowser ShowPrintPreviewDialog() 非常小

C++,如何找到成员函数的地址?

C# 怎么可能 false == true ?见图片

c# - 将 C# 项目迁移到 .NET 4.0 隐藏的问题和错误

asp.net - 使用 Entity Framework 和 VB.NET 构建解耦 N 层应用程序

sql-server - 使用 SQL Server 2008 自动生成 VB.NET 表单

c++ - 如何在 C++ 中使用 dll 文件?