Posting source code in blogger- fails with C# containers

Posted by Lirik on Stack Overflow See other posts from Stack Overflow or by Lirik
Published on 2010-05-03T01:35:30Z Indexed on 2010/05/03 1:38 UTC
Read the original article Hit count: 401

I tried the solutions that are posted in this related SO question and for the most part the code snippets are working, but there are some cases that are still getting garbled by Blogger when it publishes the blog.

In particular, declaring generic containers seems to be most troublesome. Please see the code examples on my blog and in particular the section where I define the dictionary (http://mlai-lirik.blogspot.com/).

I want to display this:

static Dictionary<int, List<Delegate>> _delegate = new Dictionary<int,List<Delegate>>();

But blogger publishes this:

static Dictionary<int, list=""><delegate>> _delegate = new Dictionary<int, list=""><delegate>>();

And it caps the end of my code section with this:

</delegate></delegate></int,></delegate></int,>

Apparently blogger thinks that the <int and <delegate> portion of the dictionary are some sort of HTML tags and it automatically attempts to close them at the end of the code snippet. Does anybody know how to get around this problem?

© Stack Overflow or respective owner

Related posts about blogging

Related posts about formatting