简体   繁体   中英

Visual Studio - C# 'out' variable intellisense completion

In C#, I often use the "Try..." methods to retrieve a value via an out variable. For example, the TryGetValue method on Dictionary . 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. 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?

在此处输入图像描述

Since it doesn't appear Visual Studio does this yet, I've added a feature request to vote or track:

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

Update: this is now an issue in the Roslyn GitHub repo:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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