BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

Displaying Formatted Source Code in a Web Page

In my last blog entry you may have noticed that my code snippet looks rather spiffy. Here, let me show off just how spiffy my source code formatting is!

    1 private ProductsTableAdapter _productsAdapter = null;

    2 protected ProductsTableAdapter Adapter

    3 {

    4     get {

    5         if (_productsAdapter == null)

    6             _productsAdapter = new ProductsTableAdapter();

    7 

    8         return _productsAdapter;

    9     }

   10 }

   11 

   12 [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]

   13 public Northwind.ProductsDataTable GetProducts()

   14 {

   15     return Adapter.GetProducts();

   16 }

Whee, that was fun and easy. Easy because of a free Visual Studio plug-in (one for VS.NET, one for VS 2005) I found earlier in the week, Colin Coller's CopySourceAsHtml (CSAH). Just highlight source code in Visual Studio, right-click and choose Copy as Html. Colin's plug-in then converts the highlighted code into HTML that accurately reflects your Visual Studio's appearance settings. A quick and easy way to show your code on your blog or in online articles!

The only downside I see is that it appears that you can't CopyHtmlAsHtml. That is, when I highlight markup in an ASP.NET page, there's no Copy as Html option in the context menu.

Published Friday, June 30, 2006 5:51 AM by Scott on Writing

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems
'