advanced web statistics

Use C# Format to Create Code Snippets

6/22/2006 11:50:03 AM

There are a lot of C# and VB.NET code snippets throughout this site.  In order to get this nicely formatted code I have to go through a very painful process.  How I've done this in the past is by finding or writing the code sample that I want to use and then pasting into a FreeTextBox control.  After this I view the HTML code and do a Find/Replace in Notepad.  I get rid of all the instances of <FONT size=1> and then size=1. Then I wrap the snippet in <CODE> tags and format by tabbing and getting the correct line breaks.

Now there is a much easier way, aside from Save-As HTML add-in for Visual Studio: C# Format.  This tool is great.  You can do different kinds of code and have the option of using an external css file or embed the CSS in the formatted snippet.  You can also add line numbers to the code.

Give it a try.

Interesting, JavaScript

kick it on DotNetKicks.com

Comments


How are you?

Posted by: tnaing | 5/27/2007 11:46:43 PM

reyrtuytuuyi

Posted by: asgfdhg | 6/14/2008 3:21:43 AM

fhgjhk

Posted by: fgfhgfhg | 6/14/2008 3:22:39 AM

Leave a Comment

   

  Enter the text to proceed!