Visual Studio code snippets: quickly build common types

Source: Internet
Author: User

Defining types is a very common task, and the following types are also very common:

Class Myclass

{

Public IntMyint {Get;Private Set;}

Public StringMystring {Get;Private Set;}

 

PublicMyclass (IntMyint,StringMystr)

{

Myint=Myint;

Mystring=Mystr;

}

}

 

The automatic attribute after C #3.0 is used as the data type, and the attribute is assigned a value in the constructor.

 

OK, I wrote this code snippets can quickly create the above type, named cc1-6, representing the supported 1-6 fields (and parameters in the constructor), CC represents the type build (Class Construction ).

 

For example, define a type of four parameters:

 

Use cc4 Name:

 

The content of the code snippets is as follows:

 

 

After entering the contentCodeWill be generated:

Class Myclass

{

Public IntMyint {Get;Private Set;}

Public StringSTR {Get;Private Set;}

Public GuidId {Get;Private Set;}

Public ObjectData {Get;Private Set;}

 

PublicMyclass (IntPmyint,StringPstr,GuidPID,ObjectPdata)

{

Myint=Pmyint;

Str=Pstr;

ID=PID;

Data=Pdata;

}

}

 

 

File Download

Note: This is an archive of Microsoft SkyDrive. Please download it directly in your browser. Some download tools may not be available for download.
File Type:. snippet

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.