Formatting code in blog entries

I just posted a blog, and spent too much time trying to get my code to format correctly.  At that, it did not turn out well.

So, I read [this blog] and found what appears to be an easier way to format code in a blog entry.

 

It it works, the code below should be very easy to read:

      

         private void ButtonFillDataGrids_Click(object sender, System.EventArgs e)

         {           

             #region Populate the first datagrid

             this.DataGrid1.DataSource =

                 CacheLoaders.GetCacheItem("NorthwindCategories",

                      new CacheLoader(CacheLoaders.GetNorthwindDataSet));

             this.DataGrid1.DataBind();

             #endregion

 

             #region Populate the second datagrid

             this.DataGrid2.DataSource =

                 CacheLoaders.GetCacheItem("Employees.Xml",

                 new CacheLoader(CacheLoaders.GetEmployeesXml));

             this.DataGrid2.DataBind();

             #endregion           

         }

Published Saturday, October 23, 2004 12:22 PM by Palermo4
Filed under: , ,

Comments

# re: Formatting code in blog entries

Saturday, October 23, 2004 3:39 PM by Jerry Pisk
Hardcoded font size, at 14pt, makes it actually more difficult to read. Just stick to <pre> and leave the font face and size up to your readers. Different people have different ideas about what's easy to read.

# re: Formatting code in blog entries

Saturday, October 23, 2004 4:18 PM by Andrew
Thats some god awful markup, i agree, stick to pre.

# re: Formatting code in blog entries

Saturday, October 23, 2004 6:30 PM by Drazen Dotlic
If you've looked at the comments to the blog post you are referring, you might have noticed a link to my Colorizer tool - it will format and colorize your code, it's free, and it has customizable colors :) PLUS your regions will be collapsible
You might want to check it out here: http://drazen.dotlic.name/weblog/articles/182.aspx

# re: Formatting code in blog entries

Saturday, October 23, 2004 7:02 PM by Wes
Check out PostXING (http://markitup.aspxconnection.com/Projects/Project.aspx?projectId=12) it s a simple free blogging tool that has a built in syntax highlighter that works pretty well. I'm acutally working on a more customizable version of this syntax highlighter (to be released soon I hope).

# re: Formatting code in blog entries

Saturday, October 23, 2004 9:04 PM by Colin
CopySourceAsHtml is an add-in for Visual Studio .NET that lets you copy source as HTML directlly from VS.NET.

http://www.jtleigh.com/people/colin/blog/archives/2004/10/copysourceashtm_1.html

# re: Formatting code in blog entries

Tuesday, November 02, 2004 11:01 AM by Michael Palermo
So far, my favorite option is CopySourceAsHtml. Thanks for the suggestion!

Leave a Comment

(required) 
(required) 
(optional)
(required)