Wednesday, March 01, 2006
Code Snippets
As most software developers know, the realities of shipping often require you to prioritize and cut features to make dates or quality metrics.
To this extent, we had to cut the property definition dialog from the custom activity designer. As the feature owner, I had to make sure you would still have a way to quickly create Dependency Properties & EventHandlers on your custom activities. To do so, I wrote 4 Code Snippets for C# and VB.NET.
Code Snippets are reusable, task-oriented blocks of code that help you automate generation of members, methods and the like. In order to invoke them, you can you can right click in the C# or VB.NET editor and select "Insert Snippet"
In C#, you will now see a "Workflow" category as part of the default snippets (as shown below)... This is also supported in VB.

There are numerous tools which help you create code snippets and a couple of websites which help you create and find code snippets.
For those 3rd party Visual Studio developers, the way to get your category to appear "by default" (instead of requiring a developer to use the Code Snippet Manager) is to set the following registry keys (thanks to Meghan Perez)
Within HKLM\Software\Microsoft\VisualStudio\8.0\Languages\CodeExpansions\ navigate to the "Paths" of the language you would like the snippets to appear in. Create new string keys and assign the value to the path of the directory which contains the snippets. It is important to note that the name of the last folder in the path defines what will appear in the Snippet Intellisense picker.
It is fairly trivial to create and distribute Code Snippets and clearly helps you template commonly used code. I spent more time getting the snippets incorporated into the Windows Workflow Foundation setup and build process than I did writing them!
Comments:
<< Home
Hi Dennis!
I am sitting here in Germany starting programming workflows with Beta2. Many documentations (Beta1) use the Parameters Editor for adding Parameters to a workflow. Could you please post some more documentation to your code snippets, especially for vb? Would be great!
Post a Comment
I am sitting here in Germany starting programming workflows with Beta2. Many documentations (Beta1) use the Parameters Editor for adding Parameters to a workflow. Could you please post some more documentation to your code snippets, especially for vb? Would be great!
<< Home