在 Visual Studio 中创建属性的快捷方式? [英] Shortcut to create properties in Visual Studio?

查看:41
本文介绍了在 Visual Studio 中创建属性的快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have seen some people creating properties in C# really fast, but how did they do it?

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

What shortcuts are available in Visual Studio (currently using Visual Studio 2010) to create properties?

我使用的是 C#.

例如

public string myString {get;set;}

推荐答案

您可以输入prop",然后按两次 Tab.这将生成以下内容.

You could type "prop" and then press tab twice. That will generate the following.

public TYPE Type { get; set; }

然后你改变TYPE"和Type":

Then you change "TYPE" and "Type":

public string myString {get; set;}

您还可以获得完整的属性,输入propfull",然后按两次 Tab.这将生成字段和完整属性.

You can also get the full property typing "propfull" and then tab twice. That would generate the field and the full property.

private int myVar;

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

这篇关于在 Visual Studio 中创建属性的快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆