C# 文本块中的无穷符号

C# 文本块中的无穷符号,c#,windows-phone-8,unicode,ivalueconverter,C#,Windows Phone 8,Unicode,Ivalueconverter,我需要TextBlock 如果我在TextBlock.Text中写”∞;“,一切都好,在TextBlock”∞" 象征 我有”∞;“TextBlock中的文本 public class MyConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInf

我需要
TextBlock

如果我在
TextBlock.Text中写
”∞;“
,一切都好,在
TextBlock
”∞" 象征

我有
”∞;“
TextBlock
中的文本

 public class MyConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {           
           return "∞";           
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
           throw new NotImplementedException();
        }
    }

有什么解决办法吗?

我在stackoverflow上找到了这个主题:

∞;
,也称为
∞;
是一个XML字符引用,它被转换为字符U+221E
当解析包含它的XML文件时。但是在XML之外,在C#string literal中,
&#
序列没有什么特殊的含义,只是一个符号和散列。C#中的字符串文本使用反斜杠字符进行转义,而不是XML样式的字符引用,以便在ASCII安全字符串文本中包含无穷大符号l:

return "\u221E";
或者,如果您的编辑器和编译器同意源代码编码,您可以简单地说:

return "∞";

我相信在转换器中,您返回的是XML编码的无穷大版本,但它应该返回原始的无穷大符号?谢谢,Sliver2009给出了答案
string a = "ɢ♠♤ä<>&'\"";
string b = HtmlEntities.Encode(a);
Console.WriteLine(b); //&#610;&spades;&#9828;&auml;<>&'"
Console.WriteLine(HtmlEntities.Decode(b)); //ɢ♠♤ä<>&'"
return HtmlEntities.Decode("& #8734;");
return "\u221E";
return "∞";