我嘗試了發佈在this related SO question中的解決方案,並且大部分代碼片段都能正常工作,但Blogger發佈博客時仍有一些情況仍然出現亂碼。在博主中發佈源代碼 - 使用C#容器失敗
特別是,聲明通用容器似乎是最麻煩的。請參閱我的博客上的代碼示例:http://mlai-lirik.blogspot.com/,特別是我聲明字典的部分。
我要顯示這樣的:
static Dictionary<int, List<Delegate>> _delegate = new Dictionary<int,List<Delegate>>();
但博主發佈了這一點:
static Dictionary<int, list=""><delegate>> _delegate = new Dictionary<int, list=""><delegate>>();
它蓋我的代碼段的這個結尾:
</delegate></delegate></int,></delegate></int,>
顯然博客認爲字典的<int
和<delegate>
部分是一些這些HTML標籤會在代碼片段結尾自動嘗試關閉它們。有人知道如何解決這個問題嗎?
更新:
我用CraftyFella's解決方案http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html,它會導致上述問題的發生(即他的解決方案沒有爲代碼段我張貼工作)。
我也嘗試用<code></code>
標籤打包我的代碼片段,但那也不起作用。結果是令人失望的相似:Dictionary<int, List<string>> test = new Dictionary<int, List<string>>();
變成Dictionary> test = new Dictionary>();
這裏有問題嗎?你說你使用了一個解決方案。這不是說它解決了嗎? – Gabe 2010-05-03 02:08:49
@加貝,對不起......我忘了提及:CraftyFella在我的問題中發佈的代碼片段中的結果。換句話說,他的解決方案不起作用。 – Kiril 2010-05-03 02:37:23