Sunday, February 24, 2008

Posting C# Code Snippets

After seeing it on Greg Young's blog, and after getting sick of my code snippets in blogger not working, I decided to try syntaxhighlighter. To find out how to use it with blogger read the usage guidelines and more importantly this page which tells you how to get setup to use it with blogger.

Anyway here is an example:


public class DomainChangeTrackingService : IDomainChangeTrackingService
{
public void ProcessMessage(DomainChangeMessage message)
{
new DomainChangeMessageRepository().Save(message);

Debug.WriteLine("Nothing");
}
}

Share This - Digg It Save to del.icio.us Stumble It! Kick It DZone

4 comments:

  1. I like the "Paste from Visual Studio" plugin for Live Writer:

    http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&bt=9&pl=8

    It preserves your color scheme from VS, whether it's XML, ASPX, or C# files. It's the only one that's consistently worked on the blog site as well as through feed readers.

    ReplyDelete
  2. Excellent I'll give it a shot.

    I did notice that syntaxhighlighter does not work with (some?) feed readers which is another reason for me to give this one a shot.

    ReplyDelete
  3. ha, finallly something on your blog i understand :-) It looks very professional.

    ReplyDelete
  4. Unfortunately Stewart pointed out it doesn't work in bloglines or in Firefox. Bah!

    ReplyDelete