简体   繁体   English

Visual Studio - C# 'out' 变量智能感知完成

[英]Visual Studio - C# 'out' variable intellisense completion

In C#, I often use the "Try..." methods to retrieve a value via an out variable.在 C# 中,我经常使用“Try...”方法通过out变量检索值。 For example, the TryGetValue method on Dictionary .例如, Dictionary上的TryGetValue方法。 I notice that Visual Studio 2019 IntelliSense shows a reasonable out parameter type and default variable name, like out SubscriptionItem value in the example shown below.我注意到 Visual Studio 2019 IntelliSense 显示了合理的输出参数类型和默认变量名称,如下图示例中的out SubscriptionItem value However, I can't figure out a way to autocomplete this and accept the suggested parameter definition in the manner of an expanded snippet.但是,我想不出一种方法来自动完成它并以扩展片段的方式接受建议的参数定义。

Is there a way to autocomplete this without manually typing out what IntelliSense is already suggesting?有没有办法自动完成此操作而无需手动输入 IntelliSense 已经建议的内容?

在此处输入图像描述

Since it doesn't appear Visual Studio does this yet, I've added a feature request to vote or track:由于 Visual Studio 尚未执行此操作,因此我添加了一个功能请求以进行投票或跟踪:

https://developercommunity.visualstudio.com/idea/1108309/c-out-variable-intellisense-completion.html https://developercommunity.visualstudio.com/idea/1108309/c-out-variable-intellisense-completion.html

Update: this is now an issue in the Roslyn GitHub repo:更新:这现在是 Roslyn GitHub repo 中的一个问题:

https://github.com/dotnet/roslyn/issues/46268 https://github.com/dotnet/roslyn/issues/46268

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM