且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-11-22 09:55:34

您可以键入托,然后preSS标签的两倍。将生成以下

  public类型类型{搞定;组; }

然后更改类型和类型:

 公共字符串的myString {搞定;组;}

您还可以得到完整的财产输入propfull,然后标签的两倍。这将产生领域和全属性。

 私人诠释myVar的;公众诠释myProperty的
{
    得到{myVar的;}
    集合{myVar的=值;}
}

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

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

I am using C#.

For example,

public string myString {get;set;}

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

public TYPE Type { get; set; }

Then you change "TYPE" and "Type":

public string myString {get; set;}

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;}
}