Posted 10 February 2010 Tweet
Here are a few of the Visual Studio C# code snippets that we use on the Silverlight team when building controls and apps.
Download a zip (7 KB) of them all and extract them into your Snippets folder, which is in your Documents folder: Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets\. These also work with Visual Studio 2008.
Inside the code editor, start typing the name of the snippet (such as dp, for a standard dependency property declaration section with a change handler). You should see it in the Intellisense drop-down.
Press tab to accept the value.
If there are editing helpers for the snippet, use tab to move through the fields as you fill them out.
Press Enter when you are finished. This should drop you right into the triple-slash comment field to fill that out.
|dp||A standard dependency property with a property changed handler|
|dp_attached||An attached property declaration|
|dp_nohandler||A dependency property without a change handler|
|dp_value||A value type dependency property with change handler|
|dp_value_nohandler||A value type dependency property without a change handler|
|inot||An INotifyPropertyChanged implementation|
|test||A simple unit test method, descriptive comment, and description attribute|
|testa||An asynchronous unit test method|
Hope this helps.
Jeff Wilcox is a Principal Software Engineer at Microsoft on the Azure team.
Jeff holds a BS in Computer Science from the University of Michigan.