in

Dé specialist in .NET trainingen en consultancy

Erik van Appeldoorn

november 2008 - Posts

  • xml code snippets in Visual Studio 2005/2008

    Using code snippets in Visual Studio can make your life a lot easier. In Visual Studio snippets have to be saved using a predefined XML schema, for details take a look here. There is a codesnippet manager as well which you can find at Tools | Code Snippets Manager...

    Next to C# and VB.NET it's possible to create XML snippets. To give it a try I made an XML snippet which I wanted to use in a web.config file. All went well until I found out that [TAB] [TAB] isn't supported in the Visual Studio XML editor...

    As an alternative you can use the Insert snippet option of the context menu, but at this point I don't like to touch the mouse anymore... here is the trick:

    1. At the point you want to insert your XML snippet type in a <

    2. Now press [Esc].

    3 Type the shortcut name of your snippet  (no way you get intellisense support now, but hang on...)

    4. Press [Tab].

    In Spanish we say: "calidad" now!

     

    Posted nov 27 2008, 08:27 by Erik with 1 comment(s)
    Filed under:
  • Another hidden VS gem: temporary project

    Often I want to demonstrate and explain quickly some code or Visual Studio features. I don't like to have all these short demo's on my Laptop. There is a nice feature in VS called temporary projects that enables you to create a project without having to save it afterwards. This gem is a somewhat hidden:

    • In VS select Tools | Options...
    • Go to Projects and Solutions | General.
    • Unselect the "Save new projects when created" option.

     

    TemporarySolutions

    Some caveats:

    • Ony one project per solution
    • Can not add to an existing solution
    • Project template must enable the feature
    Posted nov 14 2008, 12:08 by Erik with 1 comment(s)
    Filed under:
  • ParenthesizePropertyName attribute

    Last week during a training somebody asked me why some properties in the property windows of Visual Studio are decorated with brackets. It may sound stupid but I have never had a deep thougth about it. I guessed it has something to do with the sorting order of these properties, because these properties appear at the top of the sort order. So I thought it is just a trick to get the most important properties ar the top. Research showed me afterwards that's right, this is the only reason for these brackets. 

    When developing components. You can do the same trick with your own properties, just decorate the properties you want to come up at the top with the ParenthesizePropertyName attribute.

    [System.ComponentModel.ParenthesizePropertyName(true)]]

     

     

     

     

     

    Posted nov 14 2008, 10:14 by Erik with no comments
    Filed under:
  • ASP.NET 4.0 new features

    The future version of ASP.NET (4.0) will contain a lot of new features. Most features are already available on codeplex today (between the brackets: notice the new .NET logo revealed at the PDC as well). My personal highlights of the new coming version:

    - ASP.MVC
    - ASP.Dynamic Data 
    - AJAX control toolkit will be included
    - jQuery library will be included with intellisense support! Check jQuery today!
    - Provider based caching

    And for all of you tweeking the ViewState each and every day, there will be more control of the ViewState:

    - Disable on page & enable on certain controls
    - Disable on control, enable on children
    - GridView / ListView work better without Viewstate

    For all the details watch the Scott Hunter talk about ASP.NET 4.0 at channel 9: http://channel9.msdn.com/pdc2008/PC20/ and download the session slides.

     

    Posted nov 05 2008, 04:11 by Erik with no comments
    Filed under: ,