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