共用方式為


vs 2005 code snippets part 3

now for the final step we just need to add our snippet and add our replacements that we defined in the second part of this article. between the code node, paste your snippet. any item that you want to be replaced with the variable that you have defined, just replace the text with your variable (surrounded by $). The header that I use is posted below.

 

 

so when you insert this the filename, summary, date and author will be replaced and visual indicates to show that this text needs your attention.

 

to demonstrate this open a c# code project and right click at the top of the code page. select insert snippet.

 

 

select mysnippets.

 

 

select fileinfo.

 

 

after you select the snippet, the text will be inserted with variable replacements highlighted. you can then tab through each variable and make changes.

 

I hope this has been a good primer to help you get started on code snippet technology in visual studio 2005. I will be following these up with a more detailed article in Developer magazine and I will post the link here shortly.

 

ciao

patrickgallucci