简体   繁体   中英

How can I get the “Light bulb” refactoring tool in visual studio to use explicit types and not var?

When I use the light bulb refactor built into Visual Studio to generate a local variable it always uses the var syntax:

在此处输入图片说明 在此处输入图片说明

I (personally) don't like var and would prefer to it to use an explicit type (in this instance double ). so it should create the code:

double v = CalculateDownTime(lineid, start, end);

How can I alter the Visual Studio settings so that it will do this? Is it possible?

Please don't discuss the pros and cons of var vs explicit types. And no I don't want to use Resharper.

I've just found it, this related question helped

Untick the Use var when generating locals under:

在此处输入图片说明

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