c# - 在 Visual Studio 中创建属性的快捷方式?

标签 c# visual-studio properties code-snippets shortcut

我看到有些人在 C# 中创建属性的速度非常快,但他们是怎么做到的?

在 Visual Studio(目前使用 Visual Studio 2010)中可以使用哪些快捷方式来创建属性?

我正在使用 C#。

例如,

public string myString {get;set;}

最佳答案

您可以输入“prop”,然后按两次 Tab 键。这将生成以下内容。

public TYPE Type { get; set; }

然后你改变“TYPE”和“Type”:

public string myString {get; set;}

您还可以获得完整的属性,键入“propfull”然后按 Tab 键两次。这将生成字段和完整属性。

private int myVar;

public int MyProperty
{
    get { return myVar;}
    set { myVar = value;}
}

关于c# - 在 Visual Studio 中创建属性的快捷方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3871270/

相关文章:

c# - 关于经典 MVC 的问题

java - 保持 i18n 资源同步

python - 与属性类相比,使用属性装饰器是否有优势?

c# - MDB协议(protocol)(多点总线)——C#串口通信

c# - Linq to XML - 字典转换

visual-studio - 在两种解决方案中共享 aspx 文件

c# - 为单元测试设置 TestCategory 属性

java - 将 session 变量传递给 MessageSource

c# - CreateProcessAsUser 在事件 session 中创建窗口

visual-studio - 将 Visual Studio 连接到多个 Team Foundation Server