Syntax Highligher : Posting Pretty Code Samples

What technology blogger, at least those technology bloggers such as myself with a bent towards slinging some code around doesn't at least occasionally post some code.

The problem with posting code samples is that code is inherently different that prose in that it is well structured and generally viewed through and IDE that is using syntax color highlighting. Contrast that to free-flowing text that is very loosely structured (even so far as to when posting blogs, typically ignoring dozens of spelling/grammar rules) and intentionally doesn't make much use of different color words as it makes it harder to read.

That's where dp.SyntaxHighlighter comes in to play. It is a free JavaScript/CSS library that allows you to easily incorporate samples such as the one below in your post without worrying about how to format the code.

public class HelloWorld { String _name = String.empty; public HelloWorld(String name) { _name = name; } public void PrintMessage() { Debug.WriteLine("Hello, " + _name + "!"); } }