I first published my C# WPF code snippets last December in this post. Due to increasing demand for VB versions of these snippets, I spent this past weekend porting them to VB. They are now available for both languages. You can download the snippet installer here.
Updated October 1, 2008:
I just updated the snippets to play nicely with the Strict option in VB. Grab the latest installer to get a version of the VB snippets that properly casts the result of the CLR get accessors based on the DP type.
All 65 snippets are supported in both C# and VB.NET now. The shortcuts for the VB versions are slightly different because the VB code editor does not provide the same level of support for snippets as the C# editor (see rant below).
In VB, for example, you cannot just type "dp" and hit tab twice to get a list of my dependency property snippets. Instead, you must type the entire unique shortcut (e.g., "dp2") and then hit tab to expand that specific snippet. It is probably easier to install all of the snippets within a single category (like "My Code Snippets") and then select the desired snippet from a list, as shown here:
I hope the VB snippets are helpful to a few of you! Let me know if you find any problems with the ported code.
Small Rant Regarding VB Snippet Support
In my earlier post, I talked about how I am looking forward to a day when Visual Studio code snippets will support more advanced macro-like functionality. After spending some time working with snippets in VB, I realize just how lucky I am to work primarily in C#. On a scale of Classic Pong to XBox 360, the C# snippet support is probably somewhere around a PS2, whereas the VB.NET snippet support is barely a Nintendo 64!
Come on, Microsoft… show a little love for that monster base of VB developers you created in the 90’s! At a minimum, at least give them snippet parity with C#. Here are a few of my complaints:
- Intellisense should provide snippet hints.
- The user should not have to tab through every field in the snippet… just the unique fields.
- There should be support for functions like ClassName().
- The $end$ tag should be supported.
- Pressing ‘Enter’ should take the snippet out of edit mode and place the cursor at the $end$ tag.
- If there are multiple snippets with the same shortcut, typing the shortcut should provide a filtered list of descriptions for the matching snippets.
Okay, I’m sure most VB developers know how to deal with all these limitations, and since I’m not really part of that constituency, my voice probably doesn’t hold much sway in this argument… so I’m done now. Enjoy the snippets!