简体   繁体   English

在Visual Studio 2013中填充构造函数变量的快捷方式是什么?

[英]what is the shortcut to populate constructor variables in Visual Studio 2013?

I was watching a tutorial from pluralsight about asp.net MVC 5 framework And I saw something wonderful to speed up my coding. 我正在观看来自pluralsight的有关asp.net MVC 5框架的教程我看到了一些非常好的东西来加速我的编码。 I googled it and i didn't find it. 我用谷歌搜索它,我没有找到它。 perhaps I didn't use right key words. 也许我没有使用正确的关键词。 any way, this is what i saw : 无论如何,这就是我所看到的:

1- he was creating a constructor for Controller and the code was just like this : 1-他正在为Controller创建一个构造函数,代码就像这样:

 public class HomeController : Controller
   {

    public HomeController(ApplicationDbContext context)
    {

    }

and the cursor was on the word "context" , he used a shortcut and sudnly in no time code became this : 并且光标位于单词“context”上,他使用了一个快捷方式,并且在任何时候代码都变成了这样:

public class HomeController : Controller
{
    private readonly ApplicationDbContext _context;

    public HomeController(ApplicationDbContext context )
    {
        _context = context;
    }

what shortcut he used to create properties like this ? 他用来创建这样的属性的捷径是什么? anyone knows how I can do this? 有谁知道我怎么做到这一点?

That is from ReSharper. 那是来自ReSharper。 It's the Introduce Field command. 这是Introduce Field命令。 ReSharper is an excellent tool for productivity and consistency. ReSharper是提高生产率和一致性的绝佳工具。 See more information here about that feature of ReSharper: https://www.jetbrains.com/resharper/webhelp80/Refactorings__Introduce_Field.html 有关ReSharper的这一功能,请点击此处查看更多信息: https//www.jetbrains.com/resharper/webhelp80/Refactorings__Introduce_Field.html

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

相关问题 在Visual Studio 2013中打开MSDN页面的快捷方式是什么 - What is the shortcut for opening MSDN page in Visual Studio 2013 使用变量创建构造函数的快捷方式(C#Visual Studio 2010) - Shortcut for creating constructor with variables (C# Visual Studio 2010) Visual Studio 2013中的“在Blend中打开”的快捷方式在哪里? - Where is the shortcut “Open in Blend” in Visual Studio 2013? 在 Visual Studio 中创建构造函数的代码片段或快捷方式 - Code snippet or shortcut to create a constructor in Visual Studio Visual Studio 2013,通过快捷方式分离运行一个测试 - Visual Studio 2013, run one test separated via shortcut vsvim代码在Visual Studio 2013中展开/折叠或折叠/展开快捷方式 - vsvim code expand/collapse or fold/unfold shortcut in visual studio 2013 Visual Studio 2013中是否有快捷方式显示所选元素的定义弹出窗口? - Is there a shortcut in Visual Studio 2013 that shows the definition pop up of the selected element? Visual Studio是否有键盘快捷键可以为新对象调用类构造函数? - Is there a keyboard shortcut for Visual Studio to invoke the class constructor for a new object? 使用基础创建构造函数的快捷方式(C#Visual Studio 2015) - Shortcut for creating constructor with base (C# Visual Studio 2015) Visual Studio 2013中的Fakes程序集是什么? - What are Fakes assembly in Visual Studio 2013?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM